1
/* This software was developed by Bruce Hendrickson and Robert Leland *
2
* at Sandia National Laboratories under US Department of Energy *
3
* contract DE-AC04-76DP00789 and is copyrighted by Sandia Corporation. */
10
/* Find a maximal matching in a graph using one of several algorithms. */
12
int maxmatch(graph, nvtxs, nedges, mflag, using_ewgts, igeom, coords)
13
struct vtx_data **graph; /* array of vtx data for graph */
14
int nvtxs; /* number of vertices in graph */
15
int nedges; /* number of edges in graph */
16
int *mflag; /* flag indicating vtx selected or not */
17
int using_ewgts; /* are edge weights being used? */
18
int igeom; /* geometric dimensionality */
19
float **coords; /* coordinates for each vertex */
21
extern int DEBUG_COARSEN; /* debug output for coarsening? */
22
extern int MATCH_TYPE; /* which matching routine to use */
23
int nmerged; /* number of matching edges found */
24
int maxmatch1(), maxmatch2(), maxmatch3(), maxmatch4();
25
int maxmatch5(), maxmatch9();
27
if (MATCH_TYPE == 1) { /* Dumb, fast routine. */
28
nmerged = maxmatch1(graph, nvtxs, mflag, using_ewgts);
31
else if (MATCH_TYPE == 2) { /* More random but somewhat slower. */
32
nmerged = maxmatch2(graph, nvtxs, mflag, using_ewgts);
35
else if (MATCH_TYPE == 3) { /* Much more random but slower still. */
36
nmerged = maxmatch3(graph, nvtxs, mflag, using_ewgts);
39
else if (MATCH_TYPE == 4) { /* Truly random but very slow. */
40
nmerged = maxmatch4(graph, nvtxs, nedges, mflag, using_ewgts);
42
else if (MATCH_TYPE == 5) { /* Geometric nearness. */
43
nmerged = maxmatch5(graph, nvtxs, mflag, igeom, coords);
46
else if (MATCH_TYPE == 9) { /* Minimum degree of merged vertex */
47
nmerged = maxmatch9(graph, nvtxs, mflag, using_ewgts);
50
if (DEBUG_COARSEN > 0) {
51
printf("Number of matching edges = %d\n", nmerged);