diff -r c5fbd2c1d75f -r 970b265696b0 src/work/alpar/smart_graph_demo.cc --- a/src/work/alpar/smart_graph_demo.cc Wed Mar 10 16:46:17 2004 +0000 +++ b/src/work/alpar/smart_graph_demo.cc Wed Mar 10 17:47:54 2004 +0000 @@ -1,36 +1,67 @@ #include +#include #include +#include using namespace hugo; -SmartGraph::OutEdgeIt safeFirstOut(const SmartGraph &G, SmartGraph::NodeIt n) +//typedef SmartGraph Graph; +typedef EmptyGraph Graph; + + +Graph::OutEdgeIt safeFirstOut(const Graph &G, Graph::Node n) { - return G.valid(n) ? SmartGraph::OutEdgeIt(G,n):Invalid; + return G.valid(n) ? Graph::OutEdgeIt(G,n):INVALID; } int main() { - typedef SmartGraph::EdgeIt EdgeIt; - typedef SmartGraph::InEdgeIt InEdgeIt; - typedef SmartGraph::OutEdgeIt OutEdgeIt; - typedef SmartGraph::EachEdgeIt EachEdgeIt; - typedef SmartGraph::NodeIt NodeIt; - typedef SmartGraph::EachNodeIt EachNodeIt; + typedef Graph::Edge Edge; + typedef Graph::InEdgeIt InEdgeIt; + typedef Graph::OutEdgeIt OutEdgeIt; + typedef Graph::EdgeIt EdgeIt; + typedef Graph::Node Node; + typedef Graph::NodeIt NodeIt; - SmartGraph G; - EachNodeIt n; + Graph G; + NodeIt n; - // std::cout.form("%s: %d\n","Sztring",15); - for(int i=0;i<10;i++) G.addNode(); - for(G.getFirst(n);G.valid(n);G.next(n)) - for(EachNodeIt m(G);m!=Invalid;G.next(m)) + for(G.first(n);G.valid(n);G.next(n)) + for(NodeIt m(G);m!=INVALID;G.next(m)) if(n!=m) G.addEdge(n,m); OutEdgeIt e = safeFirstOut(G,n); - OutEdgeIt f = safeFirstOut(G,EachNodeIt(G)); + OutEdgeIt f = safeFirstOut(G,NodeIt(G)); + + + InEdgeIt i(INVALID), j; + InEdgeIt ii(i); + ii=G.first(i,n); + ii=G.next(i); + + OutEdgeIt o(INVALID), oo; + OutEdgeIt ooo(oo); + oo=G.first(o,n); + oo=G.next(o); + + EdgeIt ei(INVALID), eie; + EdgeIt eiee(ei); + eie=G.first(ei); + eie=G.next(ei); + + Edge eee(i); + eee=o; + eee=eie; + + + bool tm; + tm = G.valid(n) && G.valid(i) && G.valid(o) && G.valid(ei); + + std::vector v(10); + std::vector w(10,INVALID); }