-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebND_preprocess.cpp
More file actions
39 lines (31 loc) · 814 Bytes
/
webND_preprocess.cpp
File metadata and controls
39 lines (31 loc) · 814 Bytes
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
#include <iostream>
#include <fstream>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graphviz.hpp>
using namespace std;
using namespace boost;
int main(int argc, char* argv[]) {
typedef adjacency_list<setS, vecS, undirectedS> graph_type;
int fromNode;
int toNode;
ifstream inputFile;
inputFile.open(argv[1]);
ofstream outputFile;
outputFile.open(argv[2]);
char trashBuffer[256];
const int MAX_NODES = 325729;
// Build graph
graph_type graph(MAX_NODES);
inputFile.getline(trashBuffer, 256);
inputFile.getline(trashBuffer, 256);
inputFile.getline(trashBuffer, 256);
inputFile.getline(trashBuffer, 256);
while(inputFile >> fromNode >> toNode)
{
add_edge(fromNode, toNode, graph);
}
write_graphviz(outputFile, graph);
inputFile.close();
outputFile.close();
return 0;
}