COIN-OR::LEMON - Graph Library

Ignore:
Timestamp:
03/10/04 18:47:54 (20 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@231
Message:

New graph interface

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/alpar/smart_graph_demo.cc

    r157 r164  
    11#include<smart_graph.h>
     2#include<emptygraph.h>
    23
    34#include <iostream>
     5#include <vector>
    46
    57using namespace hugo;
    68
    7 SmartGraph::OutEdgeIt safeFirstOut(const SmartGraph &G, SmartGraph::NodeIt n)
     9//typedef SmartGraph Graph;
     10typedef EmptyGraph Graph;
     11
     12
     13Graph::OutEdgeIt safeFirstOut(const Graph &G, Graph::Node n)
    814{
    9   return G.valid(n) ? SmartGraph::OutEdgeIt(G,n):Invalid;
     15  return G.valid(n) ? Graph::OutEdgeIt(G,n):INVALID;
    1016}
    1117
     
    1319{
    1420
    15   typedef SmartGraph::EdgeIt EdgeIt;
    16   typedef SmartGraph::InEdgeIt InEdgeIt;
    17   typedef SmartGraph::OutEdgeIt OutEdgeIt;
    18   typedef SmartGraph::EachEdgeIt EachEdgeIt;
    19   typedef SmartGraph::NodeIt NodeIt;
    20   typedef SmartGraph::EachNodeIt EachNodeIt;
     21  typedef Graph::Edge Edge;
     22  typedef Graph::InEdgeIt InEdgeIt;
     23  typedef Graph::OutEdgeIt OutEdgeIt;
     24  typedef Graph::EdgeIt EdgeIt;
     25  typedef Graph::Node Node;
     26  typedef Graph::NodeIt NodeIt;
    2127 
    22   SmartGraph G;
    23   EachNodeIt n;
     28  Graph G;
     29  NodeIt n;
    2430
    2531
    26   //  std::cout.form("%s: %d\n","Sztring",15);
    27 
    2832  for(int i=0;i<10;i++) G.addNode();
    29   for(G.getFirst(n);G.valid(n);G.next(n))
    30     for(EachNodeIt m(G);m!=Invalid;G.next(m))
     33  for(G.first(n);G.valid(n);G.next(n))
     34    for(NodeIt m(G);m!=INVALID;G.next(m))
    3135      if(n!=m) G.addEdge(n,m);
    3236
    3337  OutEdgeIt e = safeFirstOut(G,n);
    34   OutEdgeIt f = safeFirstOut(G,EachNodeIt(G));
     38  OutEdgeIt f = safeFirstOut(G,NodeIt(G));
     39 
     40
     41  InEdgeIt i(INVALID), j;
     42  InEdgeIt ii(i);
     43  ii=G.first(i,n);
     44  ii=G.next(i);
     45 
     46  OutEdgeIt o(INVALID), oo;
     47  OutEdgeIt ooo(oo);
     48  oo=G.first(o,n);
     49  oo=G.next(o);
     50 
     51  EdgeIt ei(INVALID), eie;
     52  EdgeIt eiee(ei);
     53  eie=G.first(ei);
     54  eie=G.next(ei);
     55
     56  Edge eee(i);
     57  eee=o;
     58  eee=eie;
     59 
     60 
     61  bool tm;
     62  tm = G.valid(n) && G.valid(i) && G.valid(o) && G.valid(ei);
     63
     64  std::vector<InEdgeIt> v(10);
     65  std::vector<InEdgeIt> w(10,INVALID);
    3566 
    3667}
Note: See TracChangeset for help on using the changeset viewer.