shortest_path

compas.topology.shortest_path(adjacency, root, goal)[source]

Find the shortest path between two vertices of a network.

Parameters
  • adjacency (dict) – An adjacency dictionary.

  • root (hashable) – The identifier of the starting node.

  • goal (hashable) – The identifier of the ending node.

Returns

list, None – The path from root to goal, or None, if no path exists between the vertices.

Examples

>>>