COIN-OR::LEMON - Graph Library

source: lemon-0.x/src/work/alpar/smart_graph_demo.cc @ 163:c5fbd2c1d75f

Last change on this file since 163:c5fbd2c1d75f was 157:ee17030e5f47, checked in by Alpar Juttner, 21 years ago

One more step toward the standars interface.

File size: 803 bytes
Line 
1#include<smart_graph.h>
2
3#include <iostream>
4
5using namespace hugo;
6
7SmartGraph::OutEdgeIt safeFirstOut(const SmartGraph &G, SmartGraph::NodeIt n)
8{
9  return G.valid(n) ? SmartGraph::OutEdgeIt(G,n):Invalid;
10}
11
12int main()
13{
14
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 
22  SmartGraph G;
23  EachNodeIt n;
24
25
26  //  std::cout.form("%s: %d\n","Sztring",15);
27
28  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))
31      if(n!=m) G.addEdge(n,m);
32
33  OutEdgeIt e = safeFirstOut(G,n);
34  OutEdgeIt f = safeFirstOut(G,EachNodeIt(G));
35 
36}
Note: See TracBrowser for help on using the repository browser.