boundary_expansion

boundary_expansion#

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

Return the boundary 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 boundary expansion.

See also

vertex_expansion

Size of the neighborhood normalized by the size of the set

vertex_boundary

Vertex boundary of a set of vertices

Notes

The boundary expansion is \(|\partial S|/|S|\), where \(\partial S\) is the vertex boundary of \(S\), i.e. the (out-)neighbors of the vertices in \(S\) that are not in \(S\) (see vertex_boundary()). The time is \(O(V + E)\).

Examples

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