22 #ifndef __CCL_GRAPH_H__
23 # define __CCL_GRAPH_H__
32 typedef struct ccl_graph_st ccl_graph;
34 typedef struct ccl_vertex_st ccl_vertex;
35 typedef ccl_hash_methods ccl_vertex_data_methods;
36 typedef void ccl_vertex_map_proc (ccl_vertex *v,
void *data);
37 typedef int ccl_vertex_search_func (ccl_vertex *v,
void *data);
40 typedef struct ccl_edge_st ccl_edge;
41 typedef ccl_hash_methods ccl_edge_data_methods;
42 typedef void ccl_edge_map_proc (ccl_edge *v,
void *data);
45 extern const ccl_vertex_data_methods *CCL_GRAPH_DEFAULT_VERTEX_METHODS;
46 extern const ccl_edge_data_methods *CCL_GRAPH_DEFAULT_EDGE_METHODS;
51 ccl_graph_create (
const ccl_vertex_data_methods *vertex_methods,
52 const ccl_edge_data_methods *edge_methods);
54 #define ccl_graph_create_default() \
55 (ccl_graph_create (CCL_GRAPH_DEFAULT_VERTEX_METHODS, \
56 CCL_GRAPH_DEFAULT_EDGE_METHODS))
59 ccl_graph_add_reference (ccl_graph *G);
62 ccl_graph_del_reference (ccl_graph *G);
65 ccl_graph_get_number_of_vertices (
const ccl_graph *G);
68 ccl_graph_map_vertices (ccl_graph *G, ccl_vertex_map_proc *map,
void *data);
70 extern ccl_vertex_iterator *
71 ccl_graph_get_vertices (
const ccl_graph *G);
74 ccl_graph_get_number_of_edges (
const ccl_graph *G);
77 ccl_graph_map_edges (ccl_graph *G, ccl_edge_map_proc *map,
void *data);
79 extern ccl_edge_iterator *
80 ccl_graph_get_edges (
const ccl_graph *G);
98 ccl_graph_dup (ccl_graph *G,
105 ccl_graph_find_or_add_vertex (ccl_graph *G,
void *data);
108 ccl_graph_add_vertex (ccl_graph *G,
void *data);
111 ccl_graph_remove_vertex (ccl_graph *G, ccl_vertex *v,
int merge_edges);
114 ccl_graph_get_vertex (
const ccl_graph *G,
void *data);
117 ccl_vertex_get_data (ccl_vertex *v);
120 ccl_vertex_map_edges (ccl_vertex *v, ccl_edge_map_proc *map,
void *data);
122 extern ccl_edge_iterator *
123 ccl_vertex_get_edges (ccl_vertex *v);
126 ccl_vertex_get_degree (ccl_vertex *v);
129 ccl_vertex_map_in_edges (ccl_vertex *v, ccl_edge_map_proc *map,
void *data);
131 extern ccl_edge_iterator *
132 ccl_vertex_get_in_edges (ccl_vertex *v);
135 ccl_vertex_get_in_degree (
const ccl_vertex *v);
138 ccl_vertex_map_out_edges (ccl_vertex *v, ccl_edge_map_proc *map,
void *data);
140 extern ccl_edge_iterator *
141 ccl_vertex_get_out_edges (ccl_vertex *v);
144 ccl_vertex_get_out_degree (
const ccl_vertex *v);
147 ccl_vertex_has_successor (ccl_vertex *v, ccl_vertex *w);
149 extern ccl_vertex_iterator *
150 ccl_vertex_get_successors (ccl_vertex *v);
153 ccl_vertex_map_successors (ccl_vertex *v, ccl_vertex_map_proc *map,
157 ccl_vertex_has_predecessor (ccl_vertex *v, ccl_vertex *w);
159 extern ccl_vertex_iterator *
160 ccl_vertex_get_predecessors (ccl_vertex *v);
163 ccl_vertex_map_predecessors (ccl_vertex *v, ccl_vertex_map_proc *map,
169 ccl_graph_add_edge (ccl_graph *G, ccl_vertex *src, ccl_vertex *dst,
void *data);
172 ccl_graph_add_data_edge (ccl_graph *G,
void *sdata,
void *ddata,
void *data);
175 ccl_graph_remove_edge (ccl_graph *G, ccl_edge *e);
178 ccl_edge_get_data (
const ccl_edge *e);
181 ccl_edge_get_src (
const ccl_edge *e);
184 ccl_edge_get_tgt (
const ccl_edge *e);
189 ccl_graph_dfs (ccl_graph *G, ccl_vertex *root,
int backward,
190 ccl_vertex_search_func *map,
void *cbdata);
193 ccl_graph_bfs (ccl_graph *G, ccl_vertex *root,
int backward,
194 ccl_vertex_search_func *search,
void *cbdata);
197 ccl_graph_reverse_edges (ccl_graph *G);
199 extern ccl_vertex_iterator *
200 ccl_graph_get_roots (ccl_graph *G);
202 extern ccl_vertex_iterator *
203 ccl_graph_get_leaves (ccl_graph *G);
206 ccl_graph_compute_scc (ccl_graph *G,
207 void (*attach)(ccl_graph *G,
void *data,
int comp,
212 ccl_graph_topological_order (ccl_graph *G);
215 ccl_graph_map_reachables_from (ccl_graph *G, ccl_vertex *from,
216 ccl_vertex_search_func *search,
void *cbdata);
219 ccl_graph_is_reachable_from (ccl_graph *G, ccl_vertex *from, ccl_vertex *to);
222 ccl_graph_compute_scc_graph (ccl_graph *G,
224 void (*attach)(ccl_graph *G,
231 ccl_graph_compute_modules (ccl_graph *G,
int with_leaves);
ccl_tree * ccl_graph_compute_lsa_tree(ccl_graph *G, ccl_hash **p_v2t)
Generic simple linked list.
Structure storing a node of a generic tree.
#define CCL_ITERATOR_TYPEDEF(_typename_, _eltype_)
Macro-function used to define and declare a new iterator type.
struct ccl_list_st ccl_list
Type of a generic list.
Generic not ordered tree structure.
void * ccl_duplicate_func(void *ptr)
Prototype of functions used to duplicate an object pointed by ptr.
enum ccl_log_type_enum ccl_log_type
Enum that indicates which kind of message has to be displayed. Each kind of message can be displayed ...
A dynamic association table implemented by hashing.
struct ccl_hash_st ccl_hash
abstract type of an hash table.