COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
11/18/04 23:31:21 (20 years ago)
Author:
marci
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1398
Message:

RoadMap? to MergeGraphWrapper? and STGraphWrapper,
NewEdgeSetGraphWrapper? which is similar to the old EdgeSet?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/marci/merge_node_graph_wrapper_test.cc

    r1007 r1008  
    55#include <merge_node_graph_wrapper.h>
    66
     7#include<lemon/concept_check.h>
     8#include<lemon/concept/graph.h>
     9
    710using std::cout;
    811using std::endl;
    912
    1013using namespace lemon;
     14using namespace lemon::concept;
    1115
    1216class Graph3 : ListGraph {
     
    1923  typedef SmartGraph Graph1;
    2024  typedef ListGraph Graph2;
     25 
     26//   {
     27//     checkConcept<StaticGraph, NewEdgeSetGraphWrapper<Graph1, Graph2> >();
     28//   }
     29  {
    2130  Graph1 g;
    2231  Graph2 h;
     
    7887    gw.print();
    7988  }
     89  }
     90  {
     91    Graph1 g;
     92    Graph2 h;
     93    typedef Graph1::Node Node1;
     94    typedef Graph2::Node Node2;
     95    typedef NewEdgeSetGraphWrapper<Graph1, Graph2> GW;
     96    Graph1::NodeMap<Graph2::Node> e_node(g);
     97    Graph2::NodeMap<Graph1::Node> n_node(h);
     98    GW gw(g, h, e_node, n_node);
     99    for (int i=0; i<4; ++i) {
     100      Node1 n=g.addNode();
     101      e_node.set(n, INVALID);
     102    }
     103    for (int i=0; i<4; ++i) {
     104      Graph1::Node n1=g.addNode();
     105      Graph2::Node n2=h.addNode();
     106      e_node.set(n1, n2);
     107      n_node.set(n2, n1);
     108    }
     109    for (Graph2::NodeIt n(h); n!=INVALID; ++n)
     110      for (Graph2::NodeIt m(h); m!=INVALID; ++m)
     111        if ((h.id(n)+h.id(m))%3==0) h.addEdge(n, m);
     112//     Graph1::NodeIt n(g);
     113//     Node1 n1=n;
     114//     Node1 n2=++n;
     115//     Node1 n3=++n;
     116//     Node1 n4=n;
     117//     gw.addEdge(n1, n2);
     118//     gw.addEdge(n1, n2);
     119//     for (EdgeIt(e))
     120//   Graph1::Node n1=g.addNode();
     121//   Graph1::Node n2=g.addNode();
     122//   Graph1::Node n3=g.addNode();
     123//   Graph2::Node n4=h.addNode();
     124//   Graph2::Node n5=h.addNode();
     125    for (GW::EdgeIt e(gw); e!=INVALID; ++e)
     126      cout << gw.id(e) << endl;
     127    for (GW::NodeIt n(gw); n!=INVALID; ++n) {
     128      if (e_node[n]==INVALID) {
     129        cout<<gw.id(n)<<" INVALID"<<endl;
     130      } else {
     131        cout <<gw.id(n)<<" "<<h.id(e_node[n])<<" out_edges: ";
     132        //      cout << &e_node << endl;
     133        //cout << &n_node << endl;
     134        for (GW::OutEdgeIt e(gw, n); e!=INVALID; ++e) {
     135          cout<<gw.id(e)<<" ";
     136        }
     137        cout<< endl;
     138      }
     139    }
     140  }
    80141}
Note: See TracChangeset for help on using the changeset viewer.