Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Karger_Min_Cut< GT, SA > Class Template Reference

Karger's randomized minimum cut algorithm. More...

#include <Karger.H>

Collaboration diagram for Aleph::Karger_Min_Cut< GT, SA >:
[legend]

Classes

class  ArcIndex
 Arc index with O(1) operations and deterministic ordering. More...
 

Public Member Functions

 Karger_Min_Cut (const unsigned long _seed=time(nullptr), SA _sa=SA())
 Construct a Karger minimum cut solver.
 
 Karger_Min_Cut (const Karger_Min_Cut &)=delete
 Disable copy constructor (class owns its generator)
 
Karger_Min_Cut & operator= (const Karger_Min_Cut &)=delete
 Disable copy assignment (class owns its generator)
 
 Karger_Min_Cut (Karger_Min_Cut &&other) noexcept(std::is_nothrow_move_constructible_v< SA >)
 Move constructor.
 
Karger_Min_Cut & operator= (Karger_Min_Cut &&other) noexcept(std::is_nothrow_move_assignable_v< SA >)
 Move assignment operator.
 
unsigned long get_seed () const noexcept
 Get the random seed used by this solver (useful for reproducibility).
 
void reseed (const unsigned long new_seed) noexcept
 Change the random seed.
 
size_t compute_min_cut_size (GT &g, size_t num_iter=0)
 Compute only the minimum cut size (without partition info).
 
size_t operator() (GT &g, DynList< typename GT::Node * > &vs, DynList< typename GT::Node * > &vt, DynList< typename GT::Arc * > &cut, const size_t num_iter)
 Compute a minimum cut with a specified number of iterations.
 
size_t operator() (GT &g, DynList< typename GT::Node * > &vs, DynList< typename GT::Node * > &vt, DynList< typename GT::Arc * > &cut)
 Compute minimum cut with default number of iterations.
 
size_t fast (GT &g, DynList< typename GT::Node * > &vs, DynList< typename GT::Node * > &vt, DynList< typename GT::Arc * > &cut, size_t num_iter=0)
 Compute minimum cut using Karger-Stein fast algorithm.
 

Private Types

using Knode = Graph_Node< DynList< typename GT::Node * > >
 
using Karc = Graph_Arc< typename GT::Arc * >
 
using Kgraph = List_Graph< Knode, Karc >
 
using Node = typename GT::Node
 
using Arc = typename GT::Arc
 

Private Member Functions

bool has_self_loop (const GT &g) const
 
bool is_connected_filtered (const GT &g) const
 
void validate_graph (GT &g) const
 
void build_kgraph (GT &g, Kgraph &kg, ArcIndex &arcs)
 Build the contracted graph representation from the original graph.
 
void update_arcs (Kgraph &kg, Knode *p, Knode *t, Knode *cp, ArcIndex &arcs)
 Update arcs when contracting nodes p and t into cp.
 
void rebuild_arc_index (Kgraph &kg, ArcIndex &arcs)
 Rebuild the arc index from scratch for the given graph.
 
size_t draw_arc (const size_t num_arcs)
 The position of an arc among num_arcs, drawn out of line: a contraction takes much longer than a draw, and with the draw inline GCC stops inlining the contraction and the removal of its nodes, which cost more than the call.
 
void contract (Kgraph &kg, size_t left_num_nodes, ArcIndex &arcs)
 Contract the graph by randomly merging edges until left_num_nodes remain.
 
size_t karger_min_cut (GT &g, DynList< typename GT::Node * > &vs, DynList< typename GT::Node * > &vt, DynList< typename GT::Arc * > &cut, const size_t num_iter)
 Internal implementation of Karger's minimum cut algorithm.
 
size_t __fast_karger_min_cut (Kgraph &kg, ArcIndex &arcs)
 Karger-Stein fast minimum cut algorithm (recursive version).
 

Private Attributes

unsigned long seed
 
Gsl_Compatible_Rng_Owner r
 
SA sa
 

Detailed Description

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
class Aleph::Karger_Min_Cut< GT, SA >

Karger's randomized minimum cut algorithm.

This class implements Karger's algorithm for finding a minimum cut in an undirected graph. A minimum cut is a partition of the graph's vertices into two non-empty sets such that the number of edges crossing the partition is minimized.

The algorithm works by repeatedly contracting randomly selected edges until only two "super-nodes" remain. The edges between these super-nodes form a cut. By running multiple iterations, the algorithm finds the minimum cut with high probability.

Template parameters:

  • GT: Graph type (must be based on List_Graph with node/arc types).
  • SA: Arc filter that determines which arcs to consider. Must provide bool operator()(Arc*) returning true if the arc should be included. Defaults to Dft_Show_Arc<GT> which includes all arcs.

Time complexity:

  • Standard version: O(n^2 * m) per iteration, O(n^4) for n^2 iterations
  • Fast version (Karger-Stein): O(n^2 log^3 n)

Features:

  • Early termination when a cut of size 1 is found
  • Reuses internal graph structures across iterations for efficiency
  • Move-only semantics (non-copyable, moveable)
  • Reproducible results with seed control: the arcs are drawn by a Gsl_Compatible_Rng, which gives the numbers of the gsl_rng_mt19937 of GSL, so that a seed gives the cuts that it gave when they came from GSL
Note
This algorithm is designed for undirected graphs.
The graph must be connected (considering the arc filter) and contain no self-loops.
The graph must have at least 2 nodes and 1 arc.
Example: Finding minimum cut
GT g;
// Create a simple graph with known min-cut
auto a = g.insert_node(1);
auto b = g.insert_node(2);
auto c = g.insert_node(3);
auto d = g.insert_node(4);
// Left side
g.insert_arc(a, b);
// Right side
g.insert_arc(c, d);
// Bridge (min-cut)
g.insert_arc(b, c);
// Find minimum cut
size_t min_cut_size = karger(g, S, T, cut_arcs);
// min_cut_size will be 1 (the bridge)
// One valid partition is S={a, b}, T={c, d} (order may vary)
Doubly-linked list (defined in tpl_dynList.H).
Definition htlist.H:1231
Karger's randomized minimum cut algorithm.
Definition Karger.H:165
virtual Node * insert_node(Node *node) noexcept
Insertion of a node already allocated.
Definition tpl_graph.H:535
Arc * insert_arc(Node *src_node, Node *tgt_node, void *a)
Definition tpl_graph.H:618
std::decay_t< typename HeadC::Item_Type > T
Definition ah-zip.H:152
Arc of graph implemented with double-linked adjacency lists.
Definition tpl_graph.H:231
Example: Multiple iterations for better probability
Karger_Min_Cut<GT> karger(12345); // Seed for reproducibility
size_t best_cut = numeric_limits<size_t>::max();
DynList<GT::Node*> best_S, best_T;
// Run multiple iterations
for (int i = 0; i < 10; ++i)
{
size_t cut_size = karger(g, S, T, cut_arcs);
if (cut_size < best_cut)
{
best_cut = cut_size;
best_S = S;
best_T = T;
}
}
Example: Using fast Karger-Stein algorithm
// Fast version: O(n^2 log^3 n)
size_t cut_size = karger.fast(g, S, T, cut_arcs);
size_t fast(GT &g, DynList< typename GT::Node * > &vs, DynList< typename GT::Node * > &vt, DynList< typename GT::Arc * > &cut, size_t num_iter=0)
Compute minimum cut using Karger-Stein fast algorithm.
Definition Karger.H:639
See also
https://en.wikipedia.org/wiki/Karger%27s_algorithm

Definition at line 164 of file Karger.H.

Member Typedef Documentation

◆ Arc

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
using Aleph::Karger_Min_Cut< GT, SA >::Arc = typename GT::Arc
private

Definition at line 172 of file Karger.H.

◆ Karc

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
using Aleph::Karger_Min_Cut< GT, SA >::Karc = Graph_Arc<typename GT::Arc *>
private

Definition at line 168 of file Karger.H.

◆ Kgraph

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
using Aleph::Karger_Min_Cut< GT, SA >::Kgraph = List_Graph<Knode, Karc>
private

Definition at line 169 of file Karger.H.

◆ Knode

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
using Aleph::Karger_Min_Cut< GT, SA >::Knode = Graph_Node<DynList<typename GT::Node *> >
private

Definition at line 167 of file Karger.H.

◆ Node

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
using Aleph::Karger_Min_Cut< GT, SA >::Node = typename GT::Node
private

Definition at line 171 of file Karger.H.

Constructor & Destructor Documentation

◆ Karger_Min_Cut() [1/3]

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Aleph::Karger_Min_Cut< GT, SA >::Karger_Min_Cut ( const unsigned long  _seed = time(nullptr),
SA  _sa = SA() 
)
inline

Construct a Karger minimum cut solver.

Parameters
[in]_seedRandom seed for the algorithm. Defaults to current time. Using the same seed produces reproducible results.
[in]_saArc filter to determine which arcs to consider. Defaults to Dft_Show_Arc<GT> which includes all arcs.
Exceptions
std::bad_allocif there is not enough memory for the generator.

Definition at line 487 of file Karger.H.

◆ Karger_Min_Cut() [2/3]

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Aleph::Karger_Min_Cut< GT, SA >::Karger_Min_Cut ( const Karger_Min_Cut< GT, SA > &  )
delete

Disable copy constructor (class owns its generator)

◆ Karger_Min_Cut() [3/3]

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Aleph::Karger_Min_Cut< GT, SA >::Karger_Min_Cut ( Karger_Min_Cut< GT, SA > &&  other)
inlinenoexcept

Move constructor.

Transfers ownership of the random number generator, once the filter is moved: if its move throws, other keeps its generator.

Definition at line 502 of file Karger.H.

References Aleph::Karger_Min_Cut< GT, SA >::r, and Aleph::Gsl_Compatible_Rng_Owner::swap().

Member Function Documentation

◆ __fast_karger_min_cut()

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
size_t Aleph::Karger_Min_Cut< GT, SA >::__fast_karger_min_cut ( Kgraph &  kg,
ArcIndex &  arcs 
)
inlineprivate

◆ build_kgraph()

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
void Aleph::Karger_Min_Cut< GT, SA >::build_kgraph ( GT &  g,
Kgraph &  kg,
ArcIndex &  arcs 
)
inlineprivate

◆ compute_min_cut_size()

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
size_t Aleph::Karger_Min_Cut< GT, SA >::compute_min_cut_size ( GT &  g,
size_t  num_iter = 0 
)
inline

Compute only the minimum cut size (without partition info).

This is more efficient when you only need the cut size, not the actual partition or cut edges.

Parameters
[in]gThe undirected graph.
[in]num_iterNumber of iterations to run.
Returns
The size of the minimum cut found.
Exceptions
std::domain_errorif graph is disconnected, contains self-loops, has fewer than 2 nodes, or has no arcs.

Definition at line 547 of file Karger.H.

References arcs, Aleph::Karger_Min_Cut< GT, SA >::build_kgraph(), Aleph::Karger_Min_Cut< GT, SA >::contract(), Aleph::Gsl_Compatible_Rng_Owner::get(), GraphCommon< GT, Node, Arc >::get_num_arcs(), GraphCommon< GT, Node, Arc >::get_num_nodes(), Aleph::min_cut(), Aleph::Karger_Min_Cut< GT, SA >::r, and Aleph::Karger_Min_Cut< GT, SA >::validate_graph().

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TYPED_TEST().

◆ contract()

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
void Aleph::Karger_Min_Cut< GT, SA >::contract ( Kgraph &  kg,
size_t  left_num_nodes,
ArcIndex &  arcs 
)
inlineprivate

Contract the graph by randomly merging edges until left_num_nodes remain.

This is the core of Karger's algorithm. Each iteration:

  1. Randomly selects an arc
  2. Contracts its endpoints into a single "super-node"
  3. Removes self-loops created by the contraction
    Parameters
    [in,out]kgThe graph to contract.
    [in]left_num_nodesStop when this many nodes remain.
    [in,out]arcsIndex of arcs for O(1) random selection.

Definition at line 331 of file Karger.H.

References arcs, Aleph::Karger_Min_Cut< GT, SA >::draw_arc(), GraphCommon< GT, Node, Arc >::get_num_arcs(), GraphCommon< GT, Node, Arc >::get_num_nodes(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_node(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::remove_arc(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::remove_node(), and Aleph::Karger_Min_Cut< GT, SA >::update_arcs().

Referenced by Aleph::Karger_Min_Cut< GT, SA >::__fast_karger_min_cut(), Aleph::Karger_Min_Cut< GT, SA >::compute_min_cut_size(), and Aleph::Karger_Min_Cut< GT, SA >::karger_min_cut().

◆ draw_arc()

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
size_t Aleph::Karger_Min_Cut< GT, SA >::draw_arc ( const size_t  num_arcs)
inlineprivate

The position of an arc among num_arcs, drawn out of line: a contraction takes much longer than a draw, and with the draw inline GCC stops inlining the contraction and the removal of its nodes, which cost more than the call.

Definition at line 318 of file Karger.H.

References Aleph::Karger_Min_Cut< GT, SA >::r, and Aleph::Gsl_Compatible_Rng::uniform_int().

Referenced by Aleph::Karger_Min_Cut< GT, SA >::contract().

◆ fast()

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
size_t Aleph::Karger_Min_Cut< GT, SA >::fast ( GT &  g,
DynList< typename GT::Node * > &  vs,
DynList< typename GT::Node * > &  vt,
DynList< typename GT::Arc * > &  cut,
size_t  num_iter = 0 
)
inline

Compute minimum cut using Karger-Stein fast algorithm.

This version uses the recursive Karger-Stein algorithm which has better time complexity: O(n^2 log^3 n) vs O(n^4) for the standard.

The algorithm is run O(log^2 n) times to achieve high probability of finding the true minimum cut.

Parameters
[in]gThe undirected graph.
[out]vsNodes in the first partition (S).
[out]vtNodes in the second partition (T).
[out]cutArcs crossing the minimum cut.
[in]num_iterNumber of iterations (default: ceil(log^2 n)).
Returns
The size of the minimum cut found.
Exceptions
std::domain_errorif graph is disconnected, contains self-loops, has fewer than 2 nodes, or has no arcs.

Definition at line 639 of file Karger.H.

References Aleph::Karger_Min_Cut< GT, SA >::__fast_karger_min_cut(), Aleph::DynList< T >::append(), arcs, Aleph::Karger_Min_Cut< GT, SA >::build_kgraph(), Aleph::DynList< T >::empty(), Aleph::Gsl_Compatible_Rng_Owner::get(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::get_first_arc(), GraphCommon< GT, Node, Arc >::get_num_nodes(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::Dlink::Iterator::has_curr(), Aleph::Karger_Min_Cut< GT, SA >::r, Aleph::DynList< T >::swap(), and Aleph::Karger_Min_Cut< GT, SA >::validate_graph().

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TYPED_TEST().

◆ get_seed()

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
unsigned long Aleph::Karger_Min_Cut< GT, SA >::get_seed ( ) const
inlinenoexcept

Get the random seed used by this solver (useful for reproducibility).

Definition at line 526 of file Karger.H.

References Aleph::Karger_Min_Cut< GT, SA >::seed.

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), and TYPED_TEST().

◆ has_self_loop()

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
bool Aleph::Karger_Min_Cut< GT, SA >::has_self_loop ( const GT &  g) const
inlineprivate

◆ is_connected_filtered()

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
bool Aleph::Karger_Min_Cut< GT, SA >::is_connected_filtered ( const GT &  g) const
inlineprivate

◆ karger_min_cut()

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
size_t Aleph::Karger_Min_Cut< GT, SA >::karger_min_cut ( GT &  g,
DynList< typename GT::Node * > &  vs,
DynList< typename GT::Node * > &  vt,
DynList< typename GT::Arc * > &  cut,
const size_t  num_iter 
)
inlineprivate

Internal implementation of Karger's minimum cut algorithm.

Runs num_iter independent contractions and returns the best cut found.

Parameters
[in]gThe original undirected graph.
[out]vsNodes in partition S of the minimum cut.
[out]vtNodes in partition T of the minimum cut.
[out]cutArcs crossing the minimum cut.
[in]num_iterNumber of independent iterations to run.
Returns
Size of the minimum cut found.

Definition at line 367 of file Karger.H.

References Aleph::DynList< T >::append(), arcs, Aleph::Karger_Min_Cut< GT, SA >::build_kgraph(), Aleph::Karger_Min_Cut< GT, SA >::contract(), Aleph::DynList< T >::empty(), Aleph::List_Graph< _Graph_Node, _Graph_Arc >::get_first_arc(), GraphCommon< GT, Node, Arc >::get_num_arcs(), GraphCommon< GT, Node, Arc >::get_num_nodes(), GraphCommon< GT, Node, Arc >::get_src_node(), GraphCommon< GT, Node, Arc >::get_tgt_node(), Aleph::Dlink::Iterator::has_curr(), Aleph::min_cut(), Aleph::DynList< T >::swap(), and Aleph::Karger_Min_Cut< GT, SA >::validate_graph().

Referenced by Aleph::Karger_Min_Cut< GT, SA >::operator()(), and Aleph::Karger_Min_Cut< GT, SA >::operator()().

◆ operator()() [1/2]

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
size_t Aleph::Karger_Min_Cut< GT, SA >::operator() ( GT &  g,
DynList< typename GT::Node * > &  vs,
DynList< typename GT::Node * > &  vt,
DynList< typename GT::Arc * > &  cut 
)
inline

Compute minimum cut with default number of iterations.

Uses approximately n^2 iterations where n is the number of nodes, which gives a high probability of finding the true minimum cut.

Parameters
[in]gThe undirected graph.
[out]vsNodes in the first partition (S).
[out]vtNodes in the second partition (T).
[out]cutArcs crossing the minimum cut.
Returns
The size of the minimum cut found.
Exceptions
std::domain_errorif graph is disconnected, contains self-loops, has fewer than 2 nodes, or has no arcs.

Definition at line 611 of file Karger.H.

References Aleph::Gsl_Compatible_Rng_Owner::get(), GraphCommon< GT, Node, Arc >::get_num_nodes(), Aleph::Karger_Min_Cut< GT, SA >::karger_min_cut(), and Aleph::Karger_Min_Cut< GT, SA >::r.

◆ operator()() [2/2]

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
size_t Aleph::Karger_Min_Cut< GT, SA >::operator() ( GT &  g,
DynList< typename GT::Node * > &  vs,
DynList< typename GT::Node * > &  vt,
DynList< typename GT::Arc * > &  cut,
const size_t  num_iter 
)
inline

Compute a minimum cut with a specified number of iterations.

Parameters
[in]gThe undirected graph.
[out]vsNodes in the first partition (S).
[out]vtNodes in the second partition (T).
[out]cutArcs crossing the minimum cut.
[in]num_iterNumber of iterations to run.
Returns
The size of the minimum cut found.
Exceptions
std::domain_errorif the graph is disconnected, contains self-loops, has fewer than 2 nodes, or has no arcs.

Definition at line 589 of file Karger.H.

References Aleph::Gsl_Compatible_Rng_Owner::get(), Aleph::Karger_Min_Cut< GT, SA >::karger_min_cut(), and Aleph::Karger_Min_Cut< GT, SA >::r.

◆ operator=() [1/2]

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Karger_Min_Cut & Aleph::Karger_Min_Cut< GT, SA >::operator= ( const Karger_Min_Cut< GT, SA > &  )
delete

Disable copy assignment (class owns its generator)

◆ operator=() [2/2]

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
Karger_Min_Cut & Aleph::Karger_Min_Cut< GT, SA >::operator= ( Karger_Min_Cut< GT, SA > &&  other)
inlinenoexcept

Move assignment operator.

Transfers ownership of the random number generator. Only for a filter that can be assigned; if its move throws, nothing changes.

Definition at line 512 of file Karger.H.

References Aleph::Karger_Min_Cut< GT, SA >::r, Aleph::Karger_Min_Cut< GT, SA >::sa, and Aleph::Karger_Min_Cut< GT, SA >::seed.

◆ rebuild_arc_index()

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
void Aleph::Karger_Min_Cut< GT, SA >::rebuild_arc_index ( Kgraph &  kg,
ArcIndex &  arcs 
)
inlineprivate

Rebuild the arc index from scratch for the given graph.

Used after copying a graph to ensure pointers point to the copy's arcs.

Definition at line 307 of file Karger.H.

References arcs, and Aleph::Dlink::Iterator::has_curr().

Referenced by Aleph::Karger_Min_Cut< GT, SA >::__fast_karger_min_cut().

◆ reseed()

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
void Aleph::Karger_Min_Cut< GT, SA >::reseed ( const unsigned long  new_seed)
inlinenoexcept

Change the random seed.

Useful for running multiple independent trials.

Parameters
[in]new_seedThe new seed value.

Definition at line 530 of file Karger.H.

References Aleph::Gsl_Compatible_Rng_Owner::get(), Aleph::Gsl_Compatible_Rng::max(), Aleph::Karger_Min_Cut< GT, SA >::r, Aleph::Gsl_Compatible_Rng::seed(), and Aleph::Karger_Min_Cut< GT, SA >::seed.

Referenced by TEST(), TEST(), and TYPED_TEST().

◆ update_arcs()

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
void Aleph::Karger_Min_Cut< GT, SA >::update_arcs ( Kgraph &  kg,
Knode *  p,
Knode *  t,
Knode *  cp,
ArcIndex &  arcs 
)
inlineprivate

Update arcs when contracting nodes p and t into cp.

Moves all arcs from node p to the new contracted node cp, except arcs that connect to t (which become self-loops and are removed).

Parameters
[in,out]kgThe contracted graph.
[in]pSource node being contracted.
[in]tTarget node being contracted (arcs to t are skipped).
[in]cpNew contracted node that replaces p and t.
[in,out]arcsIndex of arcs (updated to reflect changes).

Definition at line 288 of file Karger.H.

References arcs, GTNodeCommon< NodeInfo >::get_info(), Aleph::Dlink::Iterator::has_curr(), and Aleph::List_Graph< _Graph_Node, _Graph_Arc >::insert_arc().

Referenced by Aleph::Karger_Min_Cut< GT, SA >::contract().

◆ validate_graph()

Member Data Documentation

◆ r

◆ sa

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
SA Aleph::Karger_Min_Cut< GT, SA >::sa
private

◆ seed

template<AlephGraph GT, ArcFilter< GT > SA = Dft_Show_Arc<GT>>
unsigned long Aleph::Karger_Min_Cut< GT, SA >::seed
private

The documentation for this class was generated from the following file: