ToolPythonBeginner
networkx.cut_size
Python. Called in 2 tutorials; each line below leads to its place in the tutorial.
ConceptPythonAdvanced
The graph Laplacian: why its second eigenvector cuts a network in two
- print(f"x L x = {x @ L @ x:.0f} 4 x cut = 4 x {nx.cut_size(G, hi)} x x = {x @ x:.0f}")
- print(f"sum of entries = {y.sum():.0f} y L y = {y @ L @ y:.0f} = 4 x {nx.cut_size(G, [k for k in G if y[k] > 0])}")
- print(f"sign: {len(hi)}/{n - len(hi)} wrong {wrong_side(set(hi))} cut {nx.cut_size(G, hi)}")
- print(f"median: {len(top)}/{n - len(top)} wrong {wrong_side(top)} cut {nx.cut_size(G, top)}")
- cut = nx.cut_size(G, S, weight=None)
- print(f"node 11 alone: cut {nx.cut_size(G, [11])} ratio cut {ratio_cut([11]):.2f}")
and 2 more lines in this tutorial