networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersReturnsBackRef
cut_size(G, S, T=None, weight=None)

A cut is a partition of the nodes of a graph into two sets. The cut size is the sum of the weights of the edges "between" the two sets of nodes.

Notes

In a multigraph, the cut size is the total weight of edges including multiplicity.

Parameters

G : NetworkX graph
S : collection

A collection of nodes in G.

T : collection

A collection of nodes in G. If not specified, this is taken to be the set complement of S.

weight : object

Edge attribute key to use as weight. If not specified, edges have weight one.

Returns

number

Total weight of all edges from nodes in set S to nodes in set T (and, in the case of directed graphs, all edges from nodes in T to nodes in S).

Returns the size of the cut between two sets of nodes.

Examples

>>> G = nx.barbell_graph(3, 0)
>>> S = {0, 1, 2}
>>> T = {3, 4, 5}
>>> nx.cut_size(G, S, T)
1
>>> G = nx.MultiGraph(["ab", "ab"])
>>> S = {"a"}
>>> T = {"b"}
>>> nx.cut_size(G, S, T)
2
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

networkx.algorithms.cuts.normalized_cut_size networkx.algorithms.cuts.conductance networkx.algorithms.cuts.volume

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /networkx/algorithms/cuts.py#24
type: <class 'function'>
Commit: