COIN-OR::LEMON - Graph Library

Changeset 777:5764dd9b6e18 in lemon-main for test


Ignore:
Timestamp:
09/29/09 12:03:02 (15 years ago)
Author:
Peter Kovacs <kpeter@…>
Branch:
default
Phase:
public
Message:

Add a new build() function to StaticDigraph? (#68)

This function builds the digraph from an arc list that
contains pairs of integer indices from the range [0..n-1].
It is useful in the cases when you would like to build a
StaticDigraph? from scratch, i.e. you do not want to build
another digraph that can be copied using the other build()
function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/digraph_test.cc

    r776 r777  
    442442  checkGraphConArcList(G, 4);
    443443
     444  std::vector<std::pair<int,int> > arcs;
     445  arcs.push_back(std::make_pair(0,1));
     446  arcs.push_back(std::make_pair(0,2));
     447  arcs.push_back(std::make_pair(1,3));
     448  arcs.push_back(std::make_pair(1,2));
     449  arcs.push_back(std::make_pair(3,0));
     450  arcs.push_back(std::make_pair(3,3));
     451  arcs.push_back(std::make_pair(4,2));
     452  arcs.push_back(std::make_pair(4,3));
     453  arcs.push_back(std::make_pair(4,1));
     454
     455  G.build(6, arcs.begin(), arcs.end());
     456 
     457  checkGraphNodeList(G, 6);
     458  checkGraphArcList(G, 9);
     459
     460  checkGraphOutArcList(G, G.node(0), 2);
     461  checkGraphOutArcList(G, G.node(1), 2);
     462  checkGraphOutArcList(G, G.node(2), 0);
     463  checkGraphOutArcList(G, G.node(3), 2);
     464  checkGraphOutArcList(G, G.node(4), 3);
     465  checkGraphOutArcList(G, G.node(5), 0);
     466
     467  checkGraphInArcList(G, G.node(0), 1);
     468  checkGraphInArcList(G, G.node(1), 2);
     469  checkGraphInArcList(G, G.node(2), 3);
     470  checkGraphInArcList(G, G.node(3), 3);
     471  checkGraphInArcList(G, G.node(4), 0);
     472  checkGraphInArcList(G, G.node(5), 0);
     473
     474  checkGraphConArcList(G, 9);
     475
    444476  checkNodeIds(G);
    445477  checkArcIds(G);
Note: See TracChangeset for help on using the changeset viewer.