label_k_edge_subgraphs

label_k_edge_subgraphs#

graph_tool.flow.label_k_edge_subgraphs(g, k, vprop=None)[git][source]#

Label the maximal \(k\)-edge-connected subgraphs of the graph.

Parameters:
gGraph

Graph to be used.

kint

Required edge connectivity.

vpropVertexPropertyMap (optional, default: None)

Vertex property map of value type int32_t to store the subgraph labels. If not supplied, one is created.

Returns:
compVertexPropertyMap

Vertex property map with the subgraph labels.

histnumpy.ndarray

Histogram of subgraph labels.

See also

label_k_edge_components

K-edge-connected components

is_k_edge_connected

Test for k-edge-connectivity

Notes

The maximal \(k\)-edge-connected subgraphs are the largest vertex sets whose induced subgraphs have edge connectivity at least \(k\) (strongly, if the graph is directed; see edge_connectivity()). Two of them cannot overlap, since their union would also be \(k\)-edge-connected, so that, together with the vertices that belong to none of them, which are given labels of their own, they partition the vertices. Each lies within a \(k\)-edge-connected component (see label_k_edge_components()), but the converse does not hold, since the paths that join the vertices of a component may leave it.

The subgraphs are found by recursive splitting [zhou-finding-2012] [chang-efficiently-2013]: a vertex set is reduced to its \(k\)-core (minimum in- and out-degree \(k\), if the graph is directed; see kcore_decomposition()), and each of its (strongly) connected components is either \(k\)-edge-connected, or split along a cut of fewer than \(k\) edges, which no \(k\)-edge-connected subgraph can cross, after which both sides are processed in the same way. The test of each component uses the flows and speed-ups described in label_k_edge_components(). Since every split separates at least one vertex, the time is \(O(kV^2E)\) in the worst case, but much less in practice.

Parallel edges are counted with their multiplicities; self-loops are ignored.

Parallel implementation.

If enabled during compilation, this algorithm will run in parallel using OpenMP. See the parallel algorithms section for information about how to control several aspects of parallelization.

References

[zhou-finding-2012]

Rui Zhou, Chengfei Liu, Jeffrey Xu Yu, Weifa Liang, Baichen Chen and Jianxin Li, “Finding maximal k-edge-connected subgraphs from a large graph”, Proceedings of the 15th International Conference on Extending Database Technology, 480-491 (2012), DOI: 10.1145/2247596.2247652 [sci-hub, @tor]

[chang-efficiently-2013]

Lijun Chang, Jeffrey Xu Yu, Lu Qin, Xuemin Lin, Chengfei Liu and Weifa Liang, “Efficiently computing k-edge connected components via graph decomposition”, Proceedings of the 2013 ACM SIGMOD International Conference on Management of Data, 205-216 (2013), DOI: 10.1145/2463676.2465323 [sci-hub, @tor]

Examples

>>> g = gt.collection.data["football"]
>>> comp, hist = gt.label_k_edge_subgraphs(g, 8)
>>> print(hist[hist > 1])
[114]
>>> comp, hist = gt.label_k_edge_subgraphs(g, 9)
>>> print(hist[hist > 1])
[]

In Zachary’s karate club network, the maximal 4-edge-connected subgraph is smaller than the 4-edge-connected component (see label_k_edge_components()), as can be seen in a drawing:

>>> g = gt.collection.data["karate"]
>>> comp, hist = gt.label_k_edge_subgraphs(g, 4)
>>> vcolor = g.new_vp("string", vals=np.where(hist[comp.a] > 1, "#f28c8e",
...                                           "#cccccc"))
>>> gt.graph_draw(g, g.vp.pos, vertex_fill_color=vcolor,
...               output="label_k_edge_subgraphs-karate.pdf")
<...>
../_images/label_k_edge_subgraphs-karate.png

Maximal 4-edge-connected subgraph of Zachary’s karate club network, in red. The vertices that belong to no such subgraph are shown in gray.#