Rev | Line | |
---|

[157] | 1 | #include<smart_graph.h> |
---|

[164] | 2 | #include<emptygraph.h> |
---|

[157] | 3 | |
---|

| 4 | #include <iostream> |
---|

[164] | 5 | #include <vector> |
---|

[157] | 6 | |
---|

| 7 | using namespace hugo; |
---|

| 8 | |
---|

[164] | 9 | //typedef SmartGraph Graph; |
---|

| 10 | typedef EmptyGraph Graph; |
---|

| 11 | |
---|

| 12 | |
---|

| 13 | Graph::OutEdgeIt safeFirstOut(const Graph &G, Graph::Node n) |
---|

[157] | 14 | { |
---|

[164] | 15 | return G.valid(n) ? Graph::OutEdgeIt(G,n):INVALID; |
---|

[157] | 16 | } |
---|

| 17 | |
---|

| 18 | int main() |
---|

| 19 | { |
---|

| 20 | |
---|

[164] | 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; |
---|

[157] | 27 | |
---|

[164] | 28 | Graph G; |
---|

| 29 | NodeIt n; |
---|

[157] | 30 | |
---|

| 31 | |
---|

| 32 | for(int i=0;i<10;i++) G.addNode(); |
---|

[164] | 33 | for(G.first(n);G.valid(n);G.next(n)) |
---|

| 34 | for(NodeIt m(G);m!=INVALID;G.next(m)) |
---|

[157] | 35 | if(n!=m) G.addEdge(n,m); |
---|

| 36 | |
---|

| 37 | OutEdgeIt e = safeFirstOut(G,n); |
---|

[164] | 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); |
---|

[157] | 66 | |
---|

| 67 | } |
---|

**Note:** See

TracBrowser
for help on using the repository browser.