Main Page   File List   Globals  

graph_char_array.h

Go to the documentation of this file.
00001 // graph_char_array.h
00002 // KMB 2005 Jul 15
00007 #include <stdio.h>
00008 #include <stdlib.h>
00009 #include <unistd.h>
00010 #include <time.h>
00011 #include <sys/times.h>
00012 
00013 // graph_idx maps adjacency matrix elements to a linear array as follows.
00014 // The diagonal elements are not used.
00015 
00016 // 0 1 3 6 10 ...
00017 // 2 4 7 11 ...
00018 // 5 8 12 ...
00019 // 9 13...
00020 // 14 ...
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 

Generated on Tue Jul 19 15:09:05 2005 for graphlib by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002