summaryrefslogtreecommitdiffstats
path: root/src/dep_graph.h
diff options
context:
space:
mode:
authormongo <mongo@iomega>2016-05-06 14:59:46 -0300
committermongo <mongo@iomega>2016-05-06 14:59:46 -0300
commitae2606bfa49ca65a0e5ebe40d025328e56e18ebf (patch)
treed754d29f81f25fff09f2dc4760f5ff48af11edc1 /src/dep_graph.h
parentaac40d577f60c835c97ccf8d240a6d647bd1d78b (diff)
added dep_graph
Diffstat (limited to 'src/dep_graph.h')
-rwxr-xr-xsrc/dep_graph.h38
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);