-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cc
47 lines (39 loc) · 882 Bytes
/
main.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "graph.h"
#include "dfs.h"
#include "detect.h"
#include "cycle.h"
#include "config.h"
#include <iostream>
#include <string>
int main (int argc, char* argv[]) {
Config conf;
conf.parseParameter(argc,argv);
//Read file
std::vector<Vertex> vertices = readEdgeList(conf);
conf.printdebug("Graph loaded");
conf.startClock();
//Do all sources
for(Vertex& v : vertices) {
if (v.isSource()) {
Vertex* start;
create_postorder(&v, &start);
conf.addOrder(start, &v, false);
detect(start, &v, conf);
finish(start, &v, false);
}
}
conf.printdebug("Sources cleared");
//Do rest of the graph
for(Vertex& v: vertices) {
if (v.stat == Vertex::CLEAN ) {
cycle_search(&v, conf);
}
}
conf.printdebug("Cycles cleared");
conf.endClock();
conf.writeComplete();
conf.writeOrder();
conf.writeTree();
conf.writeStats(vertices);
return 0;
}