vertex_expansion

vertex_expansion#

graph_tool.structure.vertex_expansion(g, S)[git][source]#

Return the vertex expansion of a set of vertices.

Parameters:
gGraph

Graph to be used.

Siterable of int or VertexPropertyMap

Set of vertices, as a sequence of vertices or a Boolean vertex property map.

Returns:
xfloat

The vertex expansion.

See also

boundary_expansion

Boundary size normalized by the size of the set

edge_expansion

Edge counterpart

vertex_boundary

Vertex boundary of a set of vertices

Notes

The vertex expansion is \(|N(S)|/|S|\), where \(N(S)\) is the set of (out-)neighbors of the vertices in \(S\) (which may include vertices of \(S\)). The time is \(O(V + E)\).

Examples

>>> g = gt.collection.data["karate"]
>>> print(gt.vertex_expansion(g, [0, 1, 2]))
7.333333333333...