AllPairsPathLengthMapping#

class AllPairsPathLengthMapping#

Bases: object

A custom class for the return of path lengths to target nodes from all nodes

This class is a read-only mapping of integer node indices to a PathLengthMapping of the form:

{0: {1: 1.234, 2: 2.34}}

This class is a container class for the results of functions that return a mapping of target nodes and paths from all nodes. It implements the Python mapping protocol. So you can treat the return as a read-only mapping/dict.

For example:

import rustworkx as rx

graph = rx.generators.directed_path_graph(5)
edges = rx.all_pairs_dijkstra_shortest_path_lengths(graph)
# Target node access
third_node_shortest_path_lengths = edges[2]

Methods