Converted the "minlengthpaths" alg. to the new style graph_wrappers.
11 typedef Graph<NodeData,EdgeData> TestGraph;
18 bfs_node_data<TestGraph> bfs;
27 typedef Graph<NodeData,EdgeData> TestGraph;
32 TestGraph::NodeIterator n,m;
33 TestGraph::OutEdgeIterator e;
37 //for(i=1;i<=10;i++) G.AddNode().n=i; //Ez nagyon rossz!!!!!!!!
38 for(i=1;i<=10;i++) G.AddNode()->id=i; //Ez a jo!!!!!!!!
42 //for(i=1;i<=10;i++) cout << (G.AddNode()->n=i) << ' ';
46 for(G.GetFirst(n);n.Valid();n++)
47 for(G.GetFirst(m);m.Valid();++m)
48 if(n!=m) G.AddEdge(n,m)->id=++i;
50 cout << "Number of edges: " << i << "\n\n";
52 TestGraph::AllEdgeIterator a;
53 for(G.GetFirst(a);a.Valid();++a)
54 cout << a->id << ":" << a.From()->id << "->" << a.To()->id << " ";
58 for(G.GetFirst(n);n.Valid();++n)
60 cout << n->id << "->";
61 for(G.GetFirst(e,n);e.Valid();++e)
62 cout << e->id << ":" << e.To()->id << ' ';
66 cout << "\n\n\n\nB-verzio:\n\n\n";
70 for(i=1;i<=10;i++) G.AddNode()->id=i;
73 for(n=G.First();n.Valid();n++)
74 for(m=G.First();m.Valid();++m)
75 if(n!=m) G.AddEdge(n,m)->id=++i;
78 for(n=G.First();n.Valid();++n) //Demo
82 if((e->id)%2) G.Delete(e++); //it may be nice to have a postfix ++
86 // cout << "Number of edges: " << i << "\n\n";
88 for(a=G.First();a.Valid();++a)
89 cout << a->id << ": " << a.From()->id << "->" << a.To()->id << " ";
93 for(n=G.First();n.Valid();++n)
95 cout << n->id << "->";
96 for(e=G.First(n);e.Valid();++e)
97 cout << e->id << ":" << e.To()->id << ' ';
106 for(int i=1;i<=10;i++) G.AddNode()->id=i;
109 { //I would'n say I'm really happy with this.
111 for(TestGraph::NodeIterator n(G);n.Valid();n++)
112 for(TestGraph::NodeIterator m(G);m.Valid();++m)
113 if(n!=m) G.AddEdge(n,m)->id=++i;
116 for(TestGraph::NodeIterator n(G);n.Valid();++n) //Demo
118 TestGraph::OutEdgeIterator e(G,n);
120 if((e->id)%2) G.Delete(e++); //it may be nice to have a postfix ++
124 for(TestGraph::AllEdgeIterator a(G);a.Valid();++a)
125 cout << a->id << ": " << a.From()->id << "->" << a.To()->id << " ";
129 for(TestGraph::NodeIterator n(G);n.Valid();++n)
131 cout << n->id << "->";
132 for(TestGraph::OutEdgeIterator e(G,n);e.Valid();++e)
133 cout << e->id << ":" << e.To()->id << ' ';