Minimum cut
A simple, self-contained implementation of the minimum cut algorithm in ANSI C 99
mincut.h
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (c) 2019 Haroldo Gambini Santos
3  *
4  * MinCut
5  * A self-contained, C99 compatible minimum cut implementation
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  ********************************************************************************/
12 
13 #ifndef MINCUT
14 #define MINCUT
15 
26 typedef struct _MinCut MinCut;
27 
37 MinCut *minc_create( int nArcs, const int tail[], const int head[], const int _cap[], int s, int t );
38 
39 
44 int minc_optimize( MinCut *minc );
45 
50 int minc_n( MinCut *minc );
51 
52 
57 int minc_n_cut( MinCut *minc );
58 
59 
65 int minc_cut_arc_source( MinCut *minc, int i );
66 
67 
73 int minc_cut_arc_destination( MinCut *minc, int i );
74 
80 char minc_in_s(MinCut *minc, int i);
81 
82 
85 void minc_free( MinCut **_minc );
86 
87 #endif
88 
int minc_n_cut(MinCut *minc)
number of arcs in minimum cut
MinCut * minc_create(int nArcs, const int tail[], const int head[], const int _cap[], int s, int t)
creates a min cut solver
int minc_cut_arc_destination(MinCut *minc, int i)
returns the i-th arc destination in the cut
void minc_free(MinCut **_minc)
frees memory of mincut solver
char minc_in_s(MinCut *minc, int i)
checks if a node is in the subset of the source node or not
int minc_cut_arc_source(MinCut *minc, int i)
returns the i-th arc source in the cut
int minc_n(MinCut *minc)
number of nodes in graph
int minc_optimize(MinCut *minc)
solves the min cut problem