test/graph_utils_test.h
changeset 2235 48801095a410
parent 1956 a055123339d5
child 2242 16523135943d
equal deleted inserted replaced
3:e9b3859040ab 4:94b96190e3e6
    48     typedef typename Graph::Node Node;
    48     typedef typename Graph::Node Node;
    49     typedef typename Graph::Edge Edge;
    49     typedef typename Graph::Edge Edge;
    50     typedef typename Graph::NodeIt NodeIt;
    50     typedef typename Graph::NodeIt NodeIt;
    51     typedef typename Graph::EdgeIt EdgeIt;
    51     typedef typename Graph::EdgeIt EdgeIt;
    52     Graph graph;
    52     Graph graph;
    53     srand(time(0));
       
    54     for (int i = 0; i < 10; ++i) {
    53     for (int i = 0; i < 10; ++i) {
    55       graph.addNode();
    54       graph.addNode();
    56     }
    55     }
    57     DescriptorMap<Graph, Node> nodes(graph);
    56     DescriptorMap<Graph, Node> nodes(graph);
    58     typename DescriptorMap<Graph, Node>::InverseMap invNodes(nodes);
    57     typename DescriptorMap<Graph, Node>::InverseMap invNodes(nodes);
    59     for (int i = 0; i < 100; ++i) {
    58     for (int i = 0; i < 100; ++i) {
    60       int src = (int)(rand() / (RAND_MAX + 1.0) * invNodes.size());
    59       int src = rnd.getInt(invNodes.size());
    61       int trg = (int)(rand() / (RAND_MAX + 1.0) * invNodes.size());
    60       int trg = rnd.getInt(invNodes.size());
    62       graph.addEdge(invNodes[src], invNodes[trg]);
    61       graph.addEdge(invNodes[src], invNodes[trg]);
    63     }
    62     }
    64     typename Graph::template EdgeMap<bool> found(graph, false);
    63     typename Graph::template EdgeMap<bool> found(graph, false);
    65     DescriptorMap<Graph, Edge> edges(graph);
    64     DescriptorMap<Graph, Edge> edges(graph);
    66     for (NodeIt src(graph); src != INVALID; ++src) {
    65     for (NodeIt src(graph); src != INVALID; ++src) {