diff options
author | mongo <mongo@iomega> | 2016-05-06 14:59:46 -0300 |
---|---|---|
committer | mongo <mongo@iomega> | 2016-05-06 14:59:46 -0300 |
commit | ae2606bfa49ca65a0e5ebe40d025328e56e18ebf (patch) | |
tree | d754d29f81f25fff09f2dc4760f5ff48af11edc1 /src/dep_graph.h | |
parent | aac40d577f60c835c97ccf8d240a6d647bd1d78b (diff) |
added dep_graph
Diffstat (limited to 'src/dep_graph.h')
-rwxr-xr-x | src/dep_graph.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/dep_graph.h b/src/dep_graph.h new file mode 100755 index 0000000..0c54188 --- /dev/null +++ b/src/dep_graph.h @@ -0,0 +1,38 @@ +#include "sc.h" + +// For each vertex, we need to store an element, its visited flag, its list of edges and a link to the next vertex +typedef struct vertexTag { + struct ent * ent; + int visited; + struct edgeTag * edges; + struct edgeTag * back_edges; + struct vertexTag * next; +} vertexT; + +/* For each edge, we need a link to the vertex it connects to and a link to the next edge w.r.t source vertex*/ +typedef struct edgeTag { + vertexT * connectsTo; + struct edgeTag * next; +} edgeT; + +typedef struct graphCDT { + vertexT * vertices; +} graphCDT; + +typedef struct graphCDT * graphADT; + + +graphADT GraphCreate(); +vertexT * GraphAddVertex(graphADT graph , struct ent * ent); +vertexT * getVertex(graphADT graph, struct ent * ent, int create); +void GraphAddEdge(vertexT * from, vertexT * to); +void print_vertexs(); + +void destroy_list_edges(edgeT * e); +void destroy_graph (graphADT graph); +void destroy_vertex(struct ent * ent); +void delete_reference(vertexT * v_cur, vertexT * vc, int back_reference); + +void markAllVerticesNotVisited(); +void ents_that_depends_on (graphADT graph, struct ent * ent); +int GraphIsReachable(vertexT * src, vertexT * dest, int back_dep); |