is_semiconnected#
- graph_tool.structure.is_semiconnected(g)[git][source]#
Check whether a directed graph is semiconnected.
- Parameters:
- g
Graph Directed graph.
- g
- Returns:
- semiconnected
bool Trueif, for every pair of vertices \(u, v\), there is a path from \(u\) to \(v\) or from \(v\) to \(u\).
- semiconnected
See also
label_componentsStrongly connected components
graph_tool.generation.condensation_graphGraph of the strong components
Notes
A directed graph is semiconnected if and only if its condensation (the acyclic graph of its strongly connected components) has a Hamiltonian path, i.e. if consecutive components in topological order are joined by an edge. The time is \(O(V + E)\).
Examples
>>> print(gt.is_semiconnected(gt.Graph([(0, 1), (1, 2)])), ... gt.is_semiconnected(gt.Graph([(0, 1), (0, 2)]))) True False