| 1 |
#ifndef _CMPH_GRAPH_H__ |
| 2 |
#define _CMPH_GRAPH_H__ |
| 3 |
|
| 4 |
#include <limits.h> |
| 5 |
#include "cmph_types.h" |
| 6 |
|
| 7 |
#define GRAPH_NO_NEIGHBOR UINT_MAX |
| 8 |
|
| 9 |
typedef struct __graph_t graph_t; |
| 10 |
typedef struct __graph_iterator_t graph_iterator_t; |
| 11 |
struct __graph_iterator_t |
| 12 |
{ |
| 13 |
cmph_uint32 vertex; |
| 14 |
cmph_uint32 edge; |
| 15 |
}; |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
graph_t *graph_new(cmph_uint32 nnodes, cmph_uint32 nedges); |
| 20 |
void graph_destroy(graph_t *graph); |
| 21 |
|
| 22 |
void graph_add_edge(graph_t *g, cmph_uint32 v1, cmph_uint32 v2); |
| 23 |
void graph_del_edge(graph_t *g, cmph_uint32 v1, cmph_uint32 v2); |
| 24 |
void graph_clear_edges(graph_t *g); |
| 25 |
cmph_uint32 graph_edge_id(graph_t *g, cmph_uint32 v1, cmph_uint32 v2); |
| 26 |
cmph_uint8 graph_contains_edge(graph_t *g, cmph_uint32 v1, cmph_uint32 v2); |
| 27 |
|
| 28 |
graph_iterator_t graph_neighbors_it(graph_t *g, cmph_uint32 v); |
| 29 |
cmph_uint32 graph_next_neighbor(graph_t *g, graph_iterator_t* it); |
| 30 |
|
| 31 |
void graph_obtain_critical_nodes(graph_t *g); /* included -- Fabiano*/ |
| 32 |
cmph_uint8 graph_node_is_critical(graph_t * g, cmph_uint32 v); /* included -- Fabiano */ |
| 33 |
cmph_uint32 graph_ncritical_nodes(graph_t *g); /* included -- Fabiano*/ |
| 34 |
cmph_uint32 graph_vertex_id(graph_t *g, cmph_uint32 e, cmph_uint32 id); /* included -- Fabiano*/ |
| 35 |
|
| 36 |
int graph_is_cyclic(graph_t *g); |
| 37 |
|
| 38 |
void graph_print(graph_t *); |
| 39 |
|
| 40 |
#endif |