AllPairsPathMapping#

class AllPairsPathMapping#

Bases: object

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

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

{0: {1: [0, 2, 3, 1], 2: [0, 2]}}

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_paths(graph)
# Target node access
third_node_shortest_paths = edges[2]

Methods