widest_path#
- graph_tool.structure.widest_path(g, source, target, weights)[git][source]#
Return a widest path from a source to a target vertex.
- Parameters:
- g
Graph Graph to be used.
- source
Vertexorint Source vertex.
- target
Vertexorint Target vertex.
- weights
EdgePropertyMap Edge weights (capacities).
- g
- Returns:
See also
widest_distanceWidths of the widest paths to all vertices
shortest_pathShortest path
Notes
A widest path from \(s\) to \(t\) is a path \(P\) (a directed one, for directed graphs) that maximizes its width \(\min_{e\in P} w_e\), the smallest weight of its edges. The path is obtained from the tree of
widest_distance(), in time \(O((V + E)\log V)\).Examples
>>> g = gt.Graph([(0, 1), (1, 2), (0, 2)], directed=False) >>> w = g.new_ep("double", vals=[5, 4, 2]) >>> vs, es, width = gt.widest_path(g, 0, 2, w) >>> print([int(v) for v in vs], width) [0, 1, 2] 4.0