distance between two vertices
Distance(G, s, t)
vertices of the graph
Specifies whether edge weights should be included in the calculation of weighted distance. The default is false.
Distance returns the number of edges in the shortest path from s to t. If no such path exists, the output is infinity. The strategy is to use a breadth-first search (BFS).
To find a path from s to t with minimum distance use the ShortestPath command.
P≔Graph 1: an undirected unweighted graph with 10 vertices and 15 edge(s)
DMP≔Graph 2: a directed unweighted graph with 10 vertices and 15 arc(s)
The GraphTheory[Distance] command was updated in Maple 2021.
The weighted option was introduced in Maple 2021.
For more information on Maple 2021 changes, see Updates in Maple 2021.
Download Help Document
What kind of issue would you like to report? (Optional)