#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <sys/times.h>
Go to the source code of this file.
Defines | |
#define | div2(x) ((x)>>1) |
#define | graph_idx(i, j) ((i)<=(j)?(div2((j)*((j)+1))+(i)):(div2((i)*((i)+1))+(j))) |
Typedefs | |
typedef unsigned int | node_t |
type of a node. | |
typedef char * | graph_t |
type of a graph. | |
Functions | |
graph_t | graph_new (node_t n) |
make a new undirected graph with n nodes. | |
void | graph_clear (graph_t g) |
destroy a graph. | |
void | graph_set_edge (graph_t g, node_t i, node_t j) |
add edge (i,j) to the graph. | |
int | graph_get_edge (graph_t g, node_t i, node_t j) |
return true if edge (i,j) exists in g. | |
void | graph_del_edge (graph_t g, node_t i, node_t j) |
delete edge (i,j) in g (if it exists). | |
int | graph_flip_edge (graph_t g, node_t i, node_t j) |
add edge (i,j) if it exists, else delete it. Return new state. | |
void | graph_show (graph_t g, node_t n) |
print the whole graph. | |
node_t | graph_get_degree (graph_t g, node_t i) |
return the degree of node i. | |
node_t | graph_get_nedges (graph_t g, node_t n) |
return the number of edges in the graph. | |
void | graph_write_dotfile (char *fn, graph_t g, unsigned int n) |
write a file suitable for input to dot or neato. | |
double | graph_timing_init (FILE *f) |
initialize timing. | |
double | graph_timing_end (FILE *f) |
finalize timing. |
|
A library of low-level graph functions, optimized for small, dense graphs. |