00001 #ifndef __KARGER_H
00002 #define __KARGER_H
00003
00004 extern int max_numiter;
00005 #define ALLOC(count, type) ((type *) malloc (((count) * sizeof (type))))
00006 #define CALLOC(count, type) ((type *) calloc ((size_t)(count), sizeof (type)))
00007 #define MALLOC(count, type) ((type *) malloc ((count) * sizeof (type)))
00008 #define IFFREE(object, type) \
00009 {if ((object)) { free ((void *) object); object = (type *) NULL;}}
00010 #define SWAP(x,y,temp) {temp = x; x = y; y = temp;}
00011
00012 #define TOLER 0.01
00013
00014 #define PROCESS_OVER 0
00015 #define PROCESS_INCOMPLETE 1
00016 #define PROCESS_ERROR -1
00017
00018 typedef struct setlist{
00019 struct setlist *next;
00020 int *setv;
00021 int setn;
00022 int info;
00023 double cutval;
00024 } setlist;
00025
00026
00027 typedef struct{
00028 int val;
00029 } cuts_info;
00030
00031 int
00032
00033 karger(int nnodes, int nedges, int *elist, double *elen, int alpha,
00034 double bound, double maxtime, int seed, setlist **sets,
00035 int (*choose_edge)(int, int*, double*, double, void*, int*),
00036 void *process_info,
00037 int (*process_set)(int*, int, double, void*, setlist **)
00038 ),
00039 karg_getprob (char *fname, int *ncount, int *ecount, int **elist,
00040 double **elen),
00041 choose_edge1(int nremain, int *edge, double *length, double tweight,
00042 void *process_info, int *e),
00043 add_cut(int *cutset, int cutsize, double cutweight, void *process_info,
00044 setlist **sets),
00045 process_cut(int *cutset, int cutsize, double cutweight, void *process_info,
00046 setlist **sets);
00047
00048 #endif