normalized_cut_size

normalized_cut_size#

graph_tool.structure.normalized_cut_size(g, S, T=None, weight=None)[git][source]#

Return the normalized size of the cut between two sets of vertices.

Parameters:
gGraph

Graph to be used.

Siterable of int or VertexPropertyMap

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

Titerable of int or VertexPropertyMap (optional, default: None)

Second set of vertices. If not given, the complement of S is used.

weightEdgePropertyMap (optional, default: None)

Edge weights. If not given, every edge has weight one.

Returns:
ncutfloat

The normalized cut size.

See also

conductance

Cut size normalized by the smaller volume

cut_size

Size of the cut between two sets of vertices

graph_tool.inference.NormCutState

Normalized cut partitions

Notes

The normalized cut size is \(c(S,T)[1/\mathrm{vol}(S) + 1/\mathrm{vol}(T)]\), where \(c(S,T)\) is the cut size (see cut_size()) and \(\mathrm{vol}\) the volume (see volume()). The time is \(O(V + E)\).

Examples

>>> g = gt.collection.data["karate"]
>>> S = np.arange(17)
>>> print(gt.normalized_cut_size(g, S))
0.513157894736...