edge_expansion#
- graph_tool.structure.edge_expansion(g, S, T=None, weight=None)[git][source]#
Return the edge expansion of a set of vertices.
- Parameters:
- g
Graph Graph to be used.
- Siterable of
intorVertexPropertyMap First set of vertices, as a sequence of vertices or a Boolean vertex property map.
- Titerable of
intorVertexPropertyMap(optional, default:None) Second set of vertices. If not given, the complement of
Sis used.- weight
EdgePropertyMap(optional, default:None) Edge weights. If not given, every edge has weight one.
- g
- Returns:
- h
float The edge expansion.
- h
See also
mixing_expansionCut size normalized by the total edge weight
vertex_expansionVertex counterpart
conductanceCut size normalized by the smaller volume
Notes
The edge expansion is \(c(S,T)/\min(|S|,|T|)\), where \(c(S,T)\) is the cut size (see
cut_size()). The time is \(O(V + E)\).Examples
>>> g = gt.collection.data["karate"] >>> S = np.arange(17) >>> print(gt.edge_expansion(g, S)) 1.176470588235...