vertex_connectivity

vertex_connectivity#

graph_tool.flow.vertex_connectivity(g, source=None, target=None, cut=False, approx=False)[git][source]#

Compute the vertex connectivity of the graph, or between two vertices.

Parameters:
gGraph

Graph to be used.

sourceVertex (optional, default: None)

Source vertex. If given, target must be given as well, and the local connectivity between them is computed.

targetVertex (optional, default: None)

Target vertex, which must not be adjacent to source.

cutbool (optional, default: False)

If True, a minimum vertex separator is also returned.

approxbool (optional, default: False)

If True, a fast lower bound is computed instead of the exact value (see below). It cannot be combined with cut == True.

Returns:
kappaint

The vertex connectivity.

cutVertexPropertyMap

Boolean vertex property map marking the vertices of a minimum separator. Only returned if cut == True.

See also

edge_connectivity

Edge connectivity

all_pairs_vertex_connectivity

Vertex connectivity of all pairs

disjoint_paths

Vertex- or edge-disjoint paths

all_minimum_vertex_separators

All minimum vertex separators

k_components

K-vertex-connected components

Notes

The local vertex connectivity \(\kappa(s,t)\) between two non-adjacent vertices is the smallest number of vertices whose removal leaves no path from \(s\) to \(t\), which by Menger’s theorem is equal to the maximum number of internally vertex-disjoint paths between them (see disjoint_paths()). It is obtained as a maximum flow in an auxiliary network where every vertex is replaced by an edge of unit capacity [even-network-1975], with the Edmonds-Karp algorithm in time \(O(\kappa(s,t)E)\).

The vertex connectivity \(\kappa\) of the graph is the smallest number of vertices whose removal disconnects it (strongly, if it is directed), or \(V-1\) for a complete graph. It is the minimum of \(\kappa(s,t)\) over the non-adjacent pairs, but by the argument of [esfahanian-network-1984] only the pairs formed by a vertex \(v\) of minimum degree \(\delta\) and its non-neighbors, and by the pairs of neighbors of \(v\), need to be considered, which gives \(O((V + \delta^2)\kappa E)\) time.

If approx == True, the local connectivities are replaced by the lower bound of White and Newman [white-fast-2001] described in all_pairs_vertex_connectivity(), each search stopping at the smallest value found so far, which starts at the minimum degree. The result is a lower bound of \(\kappa\), which is obtained much faster for large graphs.

Parallel edges and 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

[even-network-1975]

Shimon Even and R. Endre Tarjan, “Network flow and testing graph connectivity”, SIAM Journal on Computing 4, 507-518 (1975), DOI: 10.1137/0204043 [sci-hub, @tor]

[esfahanian-network-1984]

Abdol H. Esfahanian and S. Louis Hakimi, “On computing the connectivities of graphs and digraphs”, Networks 14, 355-366 (1984), DOI: 10.1002/net.3230140211 [sci-hub, @tor]

[white-fast-2001]

Douglas R. White and Mark E. J. Newman, “Fast approximation algorithms for finding node-independent paths in networks”, Santa Fe Institute Working Paper 01-07-035 (2001), DOI: 10.2139/ssrn.1831790 [sci-hub, @tor]

Examples

>>> g = gt.collection.data["football"]
>>> k, c = gt.vertex_connectivity(g, cut=True)
>>> print(k, c.a.nonzero()[0])
7 [18 26 29 34 43 57 63]
>>> print(gt.vertex_connectivity(g, approx=True))
7

The separator can be highlighted in a drawing of the network:

>>> vcolor = g.new_vp("string", vals=np.where(c.a, "#f28c8e", "#cccccc"))
>>> gt.graph_draw(g, g.vp.pos, vertex_fill_color=vcolor,
...               output="vertex_connectivity-football.pdf")
<...>
../_images/vertex_connectivity-football.png

Minimum vertex separator of the network of American college football games, with its vertices in red.#