src/work/alpar/smart_graph_demo.cc
changeset 157 ee17030e5f47
child 164 970b265696b0
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/work/alpar/smart_graph_demo.cc	Sun Mar 07 19:33:34 2004 +0000
     1.3 @@ -0,0 +1,36 @@
     1.4 +#include<smart_graph.h>
     1.5 +
     1.6 +#include <iostream>
     1.7 +
     1.8 +using namespace hugo;
     1.9 +
    1.10 +SmartGraph::OutEdgeIt safeFirstOut(const SmartGraph &G, SmartGraph::NodeIt n)
    1.11 +{
    1.12 +  return G.valid(n) ? SmartGraph::OutEdgeIt(G,n):Invalid;
    1.13 +}
    1.14 +
    1.15 +int main()
    1.16 +{
    1.17 +
    1.18 +  typedef SmartGraph::EdgeIt EdgeIt;
    1.19 +  typedef SmartGraph::InEdgeIt InEdgeIt;
    1.20 +  typedef SmartGraph::OutEdgeIt OutEdgeIt;
    1.21 +  typedef SmartGraph::EachEdgeIt EachEdgeIt;
    1.22 +  typedef SmartGraph::NodeIt NodeIt;
    1.23 +  typedef SmartGraph::EachNodeIt EachNodeIt;
    1.24 +  
    1.25 +  SmartGraph G;
    1.26 +  EachNodeIt n;
    1.27 +
    1.28 +
    1.29 +  //  std::cout.form("%s: %d\n","Sztring",15);
    1.30 +
    1.31 +  for(int i=0;i<10;i++) G.addNode();
    1.32 +  for(G.getFirst(n);G.valid(n);G.next(n)) 
    1.33 +    for(EachNodeIt m(G);m!=Invalid;G.next(m)) 
    1.34 +      if(n!=m) G.addEdge(n,m);
    1.35 +
    1.36 +  OutEdgeIt e = safeFirstOut(G,n);
    1.37 +  OutEdgeIt f = safeFirstOut(G,EachNodeIt(G));
    1.38 +  
    1.39 +}