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.
In a multigraph, the cut size is the total weight of edges including multiplicity.
A collection of nodes in G
.
A collection of nodes in G
. If not specified, this is taken to be the set complement of S
.
Edge attribute key to use as weight. If not specified, edges have weight one.
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.
>>> G = nx.barbell_graph(3, 0) >>> S = {0, 1, 2} >>> T = {3, 4, 5} >>> nx.cut_size(G, S, T) 1
See :>>> G = nx.MultiGraph(["ab", "ab"]) >>> S = {"a"} >>> T = {"b"} >>> nx.cut_size(G, S, T) 2
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
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