# HG changeset patch # User alpar # Date 1075115834 0 # Node ID 65dca0f43fbada3b9cd35308f8fce62a31fb7d60 # Parent 2b607665c9e26e2d7a33de04f42c15bb8179d0d9 . diff -r 2b607665c9e2 -r 65dca0f43fba src/work/graphdemo.cc --- a/src/work/graphdemo.cc Sun Jan 25 18:33:17 2004 +0000 +++ b/src/work/graphdemo.cc Mon Jan 26 11:17:14 2004 +0000 @@ -43,22 +43,22 @@ //cout << '\n'; i=0; - for(G.GetFirst(n);n.isValid();n++) - for(G.GetFirst(m);m.isValid();++m) + for(G.GetFirst(n);n.Valid();n++) + for(G.GetFirst(m);m.Valid();++m) if(n!=m) G.AddEdge(n,m)->id=++i; cout << "Number of edges: " << i << "\n\n"; TestGraph::AllEdgeIterator a; - for(G.GetFirst(a);a.isValid();++a) + for(G.GetFirst(a);a.Valid();++a) cout << a->id << ":" << a.From()->id << "->" << a.To()->id << " "; cout << "\n\n\n"; - for(G.GetFirst(n);n.isValid();++n) + for(G.GetFirst(n);n.Valid();++n) { cout << n->id << "->"; - for(G.GetFirst(e,n);e.isValid();++e) + for(G.GetFirst(e,n);e.Valid();++e) cout << e->id << ":" << e.To()->id << ' '; cout << '\n'; } @@ -70,30 +70,30 @@ for(i=1;i<=10;i++) G.AddNode()->id=i; i=0; - for(n=G.First();n.isValid();n++) - for(m=G.First();m.isValid();++m) + for(n=G.First();n.Valid();n++) + for(m=G.First();m.Valid();++m) if(n!=m) G.AddEdge(n,m)->id=++i; ; - for(n=G.First();n.isValid();++n) //Demo + for(n=G.First();n.Valid();++n) //Demo { e=G.First(n); - while(e.isValid()) + while(e.Valid()) if((e->id)%2) G.Delete(e++); //it may be nice to have a postfix ++ else ++e; } // cout << "Number of edges: " << i << "\n\n"; - for(a=G.First();a.isValid();++a) + for(a=G.First();a.Valid();++a) cout << a->id << ": " << a.From()->id << "->" << a.To()->id << " "; cout << "\n\n\n"; - for(n=G.First();n.isValid();++n) + for(n=G.First();n.Valid();++n) { cout << n->id << "->"; - for(e=G.First(n);e.isValid();++e) + for(e=G.First(n);e.Valid();++e) cout << e->id << ":" << e.To()->id << ' '; cout << '\n'; } @@ -107,29 +107,29 @@ { //I would'n say I'm really happy with this. - int i; - for(TestGraph::NodeIterator n(G);n.isValid();n++) - for(TestGraph::NodeIterator m(G);m.isValid();++m) + int i=0; + for(TestGraph::NodeIterator n(G);n.Valid();n++) + for(TestGraph::NodeIterator m(G);m.Valid();++m) if(n!=m) G.AddEdge(n,m)->id=++i; } - for(TestGraph::NodeIterator n(G);n.isValid();++n) //Demo + for(TestGraph::NodeIterator n(G);n.Valid();++n) //Demo { TestGraph::OutEdgeIterator e(G,n); - while(e.isValid()) + while(e.Valid()) if((e->id)%2) G.Delete(e++); //it may be nice to have a postfix ++ else ++e; } - for(TestGraph::AllEdgeIterator a(G);a.isValid();++a) + for(TestGraph::AllEdgeIterator a(G);a.Valid();++a) cout << a->id << ": " << a.From()->id << "->" << a.To()->id << " "; cout << "\n\n\n"; - for(TestGraph::NodeIterator n(G);n.isValid();++n) + for(TestGraph::NodeIterator n(G);n.Valid();++n) { cout << n->id << "->"; - for(TestGraph::OutEdgeIterator e(G,n);e.isValid();++e) + for(TestGraph::OutEdgeIterator e(G,n);e.Valid();++e) cout << e->id << ":" << e.To()->id << ' '; cout << '\n'; }