CARS

/home/nicola/Dropbox/Progetto SOL/CARS_terfram/src/dgraph.h

Go to the documentation of this file.
00001 
00007 #ifndef __DGRAPH_H
00008 #define __DGRAPH_H
00009 #include <stdio.h>
00010 
00012 typedef enum bool {TRUE=1, FALSE=0} bool_t;
00013 
00014 
00015 
00017 typedef struct edge {
00019   unsigned int label;     
00021   double km;      
00023   struct edge * next;    
00024 } edge_t;
00025 
00027 #define LLABEL 128
00028 
00029 #define LKM 32
00030 
00032 typedef struct node {
00034     char* label;      
00036     edge_t * adj;          
00037 } node_t;
00038 
00041 typedef struct graph {
00043   node_t * node;  
00045   unsigned int size;      
00046 } graph_t;
00047 
00048 
00049 
00068 graph_t * new_graph (unsigned int n, char **lbl);
00069 
00073 void free_graph (graph_t** g);
00074 
00078 void print_graph (graph_t* g);
00079 
00087 graph_t* copy_graph (graph_t* g);
00088 
00103 int add_edge (graph_t * g, char* e);
00104 
00113 int is_node(graph_t* g, char* ss);
00114 
00124 bool_t is_edge(graph_t* g, unsigned int n1, unsigned int n2);
00125 
00132 int degree(graph_t * g, char* lbl);  
00133 
00140 int n_size(graph_t* g); 
00141 
00142 
00149 int e_size(graph_t* g);
00150 
00170 graph_t* load_graph (FILE * fdnodes, FILE * fdarcs);
00171 
00182 int save_graph (FILE * fdnodes, FILE * fdarcs, graph_t* g);
00183 
00184 #endif