is_kl_connected

is_kl_connected#

graph_tool.structure.is_kl_connected(g, k, l)[git][source]#

Return whether the graph is locally \((k, l)\)-connected.

Parameters:
gGraph

Graph to be used.

kint

Maximum length of the paths.

lint

Number of edge-disjoint paths.

Returns:
is_klbool

True if every edge is \((k, l)\)-connected.

See also

kl_connected_subgraph

Largest locally (k, l)-connected subgraph

graph_tool.flow.edge_connectivity

Edge connectivity

Notes

An edge \((u, v)\) is \((k, l)\)-connected if there are at least \(l\) edge-disjoint paths of length at most \(k\) from \(u\) to \(v\) [chung-small-2004]. Since finding the largest number of such paths is a hard problem, they are found greedily: the edge itself is the first path, and the next paths are shortest paths, found by breadth-first search up to depth \(k\), in the graph without the edges of the previous paths. Hence, the graph may be \((k, l)\)-connected even if this function returns False, unless \(l \le 2\). The time is \(O(lE(V + E))\) in the worst case.

References

[chung-small-2004]

Fan Chung and Linyuan Lu, “The small world phenomenon in hybrid power law graphs”, in Complex Networks, Lecture Notes in Physics 650, 89-104 (Springer, 2004), DOI: 10.1007/978-3-540-44485-5_4 [sci-hub, @tor]

Examples

>>> g = gt.collection.data["karate"]
>>> u, ok = gt.kl_connected_subgraph(g, 2, 2)
>>> print(gt.is_kl_connected(g, 2, 2), gt.is_kl_connected(u, 2, 2))
False True