Infrastructure.path#

Infrastructure.path(source, target, cost_attr='latency')[source]

Retrieve the hop-level path between two nodes, if it exists.

If the path has not been computed yet, or if any hop cost has changed by more than the configured threshold, the path is recomputed and cached.

Parameters:
  • source (str) – The name of the source node.

  • target (str) – The name of the target node.

  • cost_attr (str) – The edge attribute to consider as the cost for determining whether to recompute the path. Defaults to “latency”.

Returns:

The per-hop costs as (source, target, edge_attributes), or None if no path exists.

Return type:

list[tuple[str, str, dict[str, Any]]] | None