kernighan_lin_bisection(G, partition=None, max_iter=10, weight='weight', seed=None)
This algorithm partitions a network into two sets by iteratively swapping pairs of nodes to reduce the edge cut between the two sets. The pairs are chosen according to a modified form of Kernighan-Lin, which moves node individually, alternating between sides to keep the bisection balanced.
Pair of iterables containing an initial partition. If not specified, a random balanced partition is used.
Maximum number of times to attempt swaps to find an improvemement before giving up.
Edge data key to use as weight. If None, the weights are all set to one.
Indicator of random number generation state. See Randomness<randomness>
. Only used if partition is None
If partition is not a valid partition of the nodes of the graph.
A pair of sets of nodes representing the bipartition.
Partition a graph into two blocks using the Kernighan–Lin algorithm.
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