grape.general_graph.GeneralGraph.floyd_warshall_initialization

GeneralGraph.floyd_warshall_initialization()[source]

Initialization of Floyd Warshall APSP algorithm. The distancy matrix is mutuated by NetworkX graph adjacency matrix, while the predecessors matrix is initialized with node fathers. The conversion between the labels (ids) in the graph and Numpy matrix indices (and viceversa) is also exploited.

Note

In order for the ids relation to be bijective, ‘mark’ attribute must be unique for each node.

Returns

matrix of distances; matrix of predecessors.

Return type

numpy.ndarray, numpy.ndarray