Skip to content

eles.kargerStein()

eles.kargerStein — Collection > Algorithms > Cut. Cytoscape.js signatures, parameters and return contract.

eles.kargerStein — Collection › Algorithms › Cut

Preview · Collection › Algorithms › Cut

Read in the complete API reference · All API members

// Estimate an undirected global minimum cut with the randomized Karger–Stein contraction algorithm
eles.kargerStein(): KargerSteinResult

Estimate an undirected global minimum cut with the randomized Karger–Stein contraction algorithm. Connected input is required for its guarantee. Random choices mean repeated runs may produce different partitions; the minimum-cut result is probabilistic.

Returns KargerSteinResult

{ cut, components, partition1, partition2 }; cut contains crossing edges and the two partitions contain the corresponding nodes

Example

// The exact cut can vary; this path graph's minimum cut has one edge.
console.log(eles.kargerStein().cut.edges().length); // 1

Example graph and handle setup

Throws

if fewer than two nodes are present or a contraction reaches a graph with no edges