47 if( (*gr)->nodes ==
NULL )
54 if( (*gr)->edges ==
NULL )
63 (*gr)->nedgesnonzero = m/2;
72 assert((*gr)->nuses == 0);
89 if( (*gr)->nuses == 0 )
100 printf (
"Unable to allocate memory\n");
103 number = (
long *) malloc ((n+1L) *
sizeof (long));
107 if (
number == (
long *) 0 )
109 printf (
"Unable to allocate memory\n");
133 long n, level, count, i;
136 for ( nptr = &(gr->
nodes[n-1L]); nptr >= gr->
nodes; nptr-- )
147 for ( ptr = &(active[n]); ptr >=
active; ptr-- )
149 for ( i = 0L; i <= n; i++ )
157 level = rear->
dist + 1L;
159 while ( eptr !=
NULL )
167 nptr->
dist = (int) level;
173 active[level] = nptr;
193 for ( nptr = &(gr->
nodes[n-1L]); nptr >= gr->
nodes; nptr-- )
197 nptr->
dist = (int) n;
218 GRAPHNODE *aptr, *nptr, *q_front, *q_rear;
220 long n, m, m0, level, i, n_discharge;
229 for ( nptr = &(gr->
nodes[n-1L]); nptr >= gr->
nodes; nptr-- )
237 fprintf (stderr,
"isolated node in input graph\n");
249 for ( eptr = &(gr->
edges[m-1L]); eptr >= gr->
edges; eptr-- )
251 for ( eptr = &(gr->
edges[m0+m-1L]); eptr >= &(gr->
edges[m0]); eptr-- )
254 for ( i = n; i >= 0L; i-- )
268 level = q_rear->
dist + 1L;
270 while ( eptr !=
NULL )
277 nptr->
dist = (int) level;
284 if ( q_rear == q_front )
294 for ( nptr = &(gr->
nodes[n-1]); nptr >= gr->
nodes; --nptr )
301 s_ptr->
dist = (int) n;
310 while ( eptr !=
NULL )
321 if ( nptr != t_ptr && nptr->
excess <= cap +
EPS )
326 active[nptr->
dist] = nptr;
344 while ( aptr !=
NULL )
348 assert(eptr !=
NULL);
353 assert(eptr !=
NULL);
358 assert(nptr !=
NULL);
362 if ( incre <= eptr->rcap )
373 active[nptr->
dist] = nptr;
391 active[nptr->
dist] = nptr;
421 for ( nptr = &(gr->
nodes[n-1L]); nptr >= gr->
nodes; nptr-- )
428 nptr->
dist = (int) n;
435 aptr->
dist = (int) n;
445 while ( eptr !=
NULL )
458 if ( ++dmin <
bound )
462 aptr->
dist = (int) dmin;
466 assert(eptr !=
NULL);
474 aptr->
dist = (int) n;
486 if ( n_discharge == n )
497 return (
int) (t_ptr->
excess - 1.0L);
502 while( i != j && j != 0 )
516 for(
int i = 1; i < gr->
nnodes; i++ )
521 for(
int j = 1 ; j < gr->
nnodes; j++ )
534 for(
int i = 1; i < gr->
nnodes; i++ )
559 GRAPHNODE *nptr, *nptr1, *nptrn, *sptr, *tptr;
569 nptrn = &(gr->
nodes[n-1L]);
570 for ( nptr = nptrn; nptr >= nptr1; nptr-- )
573 for ( sptr = &(gr->
nodes[1L]); sptr <= nptrn; sptr++ )
576 maxfl =
maxflow(gr, sptr, tptr);
588 for ( nptr = &(gr->
nodes[1L]); nptr <= nptrn; nptr++ )
589 if ( nptr != sptr && ! nptr->
alive && nptr->
parent == tptr )
SCIP_Bool create_graph(int n, int m, GRAPH **gr)
#define BMSallocMemoryArray(ptr, num)
static GRAPHNODE ** active
generator for global cuts in undirected graphs
#define BMSfreeMemory(ptr)
double maxflow(GRAPH *gr, GRAPHNODE *s_ptr, GRAPHNODE *t_ptr)
void global_relabel(GRAPH *gr, GRAPHNODE *tptr)
static SCIP_Bool co_check
struct GraphEdge * scan_ptr
#define BMSfreeMemoryArray(ptr)
struct GraphNode * parent
struct GraphEdge * first_edge
C++ wrapper classes for SCIP.
struct GraphNode * stack_link
SCIP_Bool ghc_tree(GRAPH *gr, SCIP_Bool **cuts, int *ncuts, double minviol)
void constructCutList(GRAPH *gr, SCIP_Bool **cuts, int *ncuts, double minviol)
static void free_graph(GRAPH **gr)
#define BMSallocMemory(ptr)
void constructSingleCut(GRAPH *gr, SCIP_Bool **cuts)
SCIP_Bool init_maxflow(long n)
struct GraphNode * bfs_link
void capture_graph(GRAPH *gr)
void release_graph(GRAPH **gr)
SCIP_Bool nodeOnRootPath(GRAPH *gr, int i, int j)