00001
00002
00007 #include <stdio.h>
00008 #include <stdlib.h>
00009 #include <unistd.h>
00010 #include <time.h>
00011 #include <sys/times.h>
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #define div2(x) ((x)>>1)
00024 #define graph_idx(i,j) ((i)<=(j)?(div2((j)*((j)+1))+(i)):(div2((i)*((i)+1))+(j)))
00025
00028
00029 typedef unsigned int node_t;
00030
00032 typedef char* graph_t;
00033
00035 graph_t graph_new(node_t n);
00036
00038 void graph_clear(graph_t g);
00039
00041 void graph_set_edge(graph_t g, node_t i, node_t j);
00042
00044 int graph_get_edge(graph_t g, node_t i, node_t j);
00045
00047 void graph_del_edge(graph_t g, node_t i, node_t j);
00048
00050 int graph_flip_edge(graph_t g, node_t i, node_t j);
00051
00053 void graph_show(graph_t g, node_t n);
00054
00056 node_t graph_get_degree(graph_t g, node_t i);
00057
00059 node_t graph_get_nedges(graph_t g, node_t n);
00060
00062 void graph_write_dotfile(char* fn, graph_t g, unsigned int n);
00063
00065 double graph_timing_init(FILE *f);
00066
00068 double graph_timing_end(FILE *f);
00069