Rev | Line | |
---|
[157] | 1 | #include<smart_graph.h> |
---|
| 2 | |
---|
| 3 | #include <iostream> |
---|
| 4 | |
---|
| 5 | using namespace hugo; |
---|
| 6 | |
---|
| 7 | SmartGraph::OutEdgeIt safeFirstOut(const SmartGraph &G, SmartGraph::NodeIt n) |
---|
| 8 | { |
---|
| 9 | return G.valid(n) ? SmartGraph::OutEdgeIt(G,n):Invalid; |
---|
| 10 | } |
---|
| 11 | |
---|
| 12 | int 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.