test/arc_look_up_test.cc
author Alpar Juttner <alpar@cs.elte.hu>
Mon, 05 Aug 2013 14:21:58 +0200
changeset 1251 218171dc022d
child 1270 dceba191c00d
permissions -rw-r--r--
Doxygen config improvements (#459)

- remove an erroneous line from DoxygenLayout.xml
- libstdc++ doxygen tagfile version is configurable
- use fixed gcc doc version (4.7.3) instead of the latest one
alpar@1149
     1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
alpar@1149
     2
 *
alpar@1149
     3
 * This file is a part of LEMON, a generic C++ optimization library.
alpar@1149
     4
 *
alpar@1149
     5
 * Copyright (C) 2003-2009
alpar@1149
     6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
alpar@1149
     7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
alpar@1149
     8
 *
alpar@1149
     9
 * Permission to use, modify and distribute this software is granted
alpar@1149
    10
 * provided that this copyright notice appears in all copies. For
alpar@1149
    11
 * precise terms see the accompanying LICENSE file.
alpar@1149
    12
 *
alpar@1149
    13
 * This software is provided "AS IS" with no warranty of any kind,
alpar@1149
    14
 * express or implied, and with no claim as to its suitability for any
alpar@1149
    15
 * purpose.
alpar@1149
    16
 *
alpar@1149
    17
 */
alpar@1149
    18
alpar@1149
    19
#include <iostream>
alpar@1149
    20
#include "lemon/list_graph.h"
alpar@1149
    21
#include "lemon/lgf_reader.h"
alpar@1149
    22
alpar@1149
    23
#include "test_tools.h"
alpar@1149
    24
alpar@1149
    25
using namespace lemon;
alpar@1149
    26
alpar@1149
    27
const int lgfn = 4;
alpar@1149
    28
const std::string lgf =
alpar@1149
    29
  "@nodes\n"
alpar@1149
    30
"label\n"
alpar@1149
    31
"0\n"
alpar@1149
    32
"1\n"
alpar@1149
    33
"2\n"
alpar@1149
    34
"3\n"
alpar@1149
    35
"4\n"
alpar@1149
    36
"5\n"
alpar@1149
    37
"6\n"
alpar@1149
    38
"@arcs\n"
alpar@1149
    39
"label\n"
alpar@1149
    40
"5 6 0\n"
alpar@1149
    41
"5 4 1\n"
alpar@1149
    42
"4 6 2\n"
alpar@1149
    43
"3 4 3\n"
alpar@1149
    44
"3 4 4\n"
alpar@1149
    45
"3 2 5\n"
alpar@1149
    46
"3 5 6\n"
alpar@1149
    47
"3 5 7\n"
alpar@1149
    48
"3 5 8\n"
alpar@1149
    49
"3 5 9\n"
alpar@1149
    50
"2 4 10\n"
alpar@1149
    51
"2 4 11\n"
alpar@1149
    52
"2 4 12\n"
alpar@1149
    53
"2 4 13\n"
alpar@1149
    54
"1 2 14\n"
alpar@1149
    55
"1 2 15\n"
alpar@1149
    56
"1 0 16\n"
alpar@1149
    57
"1 3 17\n"
alpar@1149
    58
"1 3 18\n"
alpar@1149
    59
"1 3 19\n"
alpar@1149
    60
"1 3 20\n"
alpar@1149
    61
"0 2 21\n"
alpar@1149
    62
"0 2 22\n"
alpar@1149
    63
"0 2 23\n"
alpar@1149
    64
"0 2 24\n";
alpar@1149
    65
alpar@1149
    66
alpar@1149
    67
int main() {
alpar@1149
    68
  ListDigraph graph;
alpar@1149
    69
  std::istringstream lgfs(lgf);
alpar@1149
    70
  DigraphReader<ListDigraph>(graph, lgfs).run();
alpar@1149
    71
  
alpar@1149
    72
  AllArcLookUp<ListDigraph> lookup(graph);
alpar@1149
    73
	
alpar@1149
    74
  int numArcs = countArcs(graph);
alpar@1149
    75
	
alpar@1149
    76
  int arcCnt = 0;
alpar@1149
    77
  for(ListDigraph::NodeIt n1(graph); n1 != INVALID; ++n1)
alpar@1149
    78
    for(ListDigraph::NodeIt n2(graph); n2 != INVALID; ++n2)
alpar@1149
    79
      for(ListDigraph::Arc a = lookup(n1, n2); a != INVALID;
alpar@1149
    80
	  a = lookup(n1, n2, a))
alpar@1149
    81
	++arcCnt;
alpar@1149
    82
  check(arcCnt==numArcs, "Wrong total number of arcs");
alpar@1149
    83
alpar@1149
    84
  return 0;
alpar@1149
    85
}