Revision ee0dd796 custompackages/graph-parser/src/main.cpp

View differences:

custompackages/graph-parser/src/main.cpp
2 2
#include "parser.h"
3 3
#include "utility.h"
4 4
#include "centrality.h"
5
#include "bi_connected_components.h"
5 6

  
6 7

  
8
void handleSimpleGraph() {
9
    /* I don't understand the output. Why there are 8 vertices?
10
        Simple graph
11
        0
12
        1
13
        2
14
        3
15
        4
16
        5
17
        6
18
        7
19
        8
20
    */
21
    typedef boost::adjacency_list<> G;
22
    G a;
23
    {
24
        boost::graph_traits<G>::vertex_descriptor v, u, t;
25
        u = vertex(1, a);
26
        v = vertex(8, a);
27
        // t = vertex(5, a);
28
        add_edge(u, v, a);
29
        // add_edge(u, t, a);
30
    }
31

  
32
    std::set<typename boost::graph_traits<G>::vertex_descriptor> av;
33
    cout << "Simple graph" << endl;
34
    BGL_FORALL_VERTICES_T(v, a, G) {
35
        cout << v << endl;
36
    }
37
}
7 38
void handleSimpleInput(string filePath) {
8 39
    // Read the input.edges
9 40
    Graph g;
......
36 67
    cout << "Done with Betweenness Centrality" << endl;
37 68
}
38 69

  
70
void testHeuristic(string filePath) {
71
    Graph g;
72
    readEdgeFile(filePath, g);
73
    outops::operator<<(cout, g);
74
    BiConnectedComponents bcc(g);
75
    // bcc.compute_weight();
76
    // bcc.findBetweennessCentrality();
77
    // bcc.printBetweennessCentrality();
78
    // bcc.print_weight();
79
    // bcc.print();
80
    cout << "DONE" << endl;
81

  
39 82

  
40
int main(int, char *[]) {
41
    string edgeFilePath = "../input/ninux_30_1.edges";
42
    handleSimpleInput(edgeFilePath);
83
}
43 84

  
44
    string jsonFilePath = "../input/olsr-netjson.json";
45
    handleJsonInput(jsonFilePath);
85
int main(int, char *[]) {
86
//    string edgeFilePath = "../input/ninux_30_1.edges";
87
//    testHeuristic(edgeFilePath);
88
//    handleSimpleInput(edgeFilePath);
89
//
90
//    string jsonFilePath = "../input/olsr-netjson.json";
91
//    handleJsonInput(jsonFilePath);
92
//
93
//    string complexJsonFilePath = "../input/jsoninfo_topo.json";
94
//    handleComplexJsonInput(complexJsonFilePath);
46 95

  
47
    string complexJsonFilePath = "../input/jsoninfo_topo.json";
48
    handleComplexJsonInput(complexJsonFilePath);
49 96

  
97
    string simpleGraphFilePath = "../input/simple.edges";
98
    testHeuristic(simpleGraphFilePath);
50 99
    return 0;
51 100
}

Also available in: Unified diff