src/work/alpar/smart_graph_demo.cc
author jacint
Tue, 09 Mar 2004 15:53:19 +0000
changeset 160 f1a7005e9dff
child 164 970b265696b0
permissions -rw-r--r--
*** empty log message ***
alpar@157
     1
#include<smart_graph.h>
alpar@157
     2
alpar@157
     3
#include <iostream>
alpar@157
     4
alpar@157
     5
using namespace hugo;
alpar@157
     6
alpar@157
     7
SmartGraph::OutEdgeIt safeFirstOut(const SmartGraph &G, SmartGraph::NodeIt n)
alpar@157
     8
{
alpar@157
     9
  return G.valid(n) ? SmartGraph::OutEdgeIt(G,n):Invalid;
alpar@157
    10
}
alpar@157
    11
alpar@157
    12
int main()
alpar@157
    13
{
alpar@157
    14
alpar@157
    15
  typedef SmartGraph::EdgeIt EdgeIt;
alpar@157
    16
  typedef SmartGraph::InEdgeIt InEdgeIt;
alpar@157
    17
  typedef SmartGraph::OutEdgeIt OutEdgeIt;
alpar@157
    18
  typedef SmartGraph::EachEdgeIt EachEdgeIt;
alpar@157
    19
  typedef SmartGraph::NodeIt NodeIt;
alpar@157
    20
  typedef SmartGraph::EachNodeIt EachNodeIt;
alpar@157
    21
  
alpar@157
    22
  SmartGraph G;
alpar@157
    23
  EachNodeIt n;
alpar@157
    24
alpar@157
    25
alpar@157
    26
  //  std::cout.form("%s: %d\n","Sztring",15);
alpar@157
    27
alpar@157
    28
  for(int i=0;i<10;i++) G.addNode();
alpar@157
    29
  for(G.getFirst(n);G.valid(n);G.next(n)) 
alpar@157
    30
    for(EachNodeIt m(G);m!=Invalid;G.next(m)) 
alpar@157
    31
      if(n!=m) G.addEdge(n,m);
alpar@157
    32
alpar@157
    33
  OutEdgeIt e = safeFirstOut(G,n);
alpar@157
    34
  OutEdgeIt f = safeFirstOut(G,EachNodeIt(G));
alpar@157
    35
  
alpar@157
    36
}