8 typedef Graph<int,int> TestGraph;
10 int gcd(int a,int b) {int c; while((c=a%b)) {a=b;b=c;} ; return b;}
16 TestGraph::NodeIterator tn,n2;
18 cout << "Create nodes\n";
20 for(int i=1;i<=500;i++)
26 cout << "Create Edges\n";
28 for(TestGraph::NodeIterator n(G);n.isValid();++n)
29 for(TestGraph::NodeIterator m(G);m.isValid();++m) if(n!=m)
30 if(gcd(*n,*m)>1) G.AddEdge(n,m);
35 Bfs<default_bfs_T<TestGraph> > bfs;
41 for(TestGraph::NodeIterator n(G);n.isValid();++n)
43 cout << (Get(bfs.dist_map,n)) << '\n';
45 for(TestGraph::NodeIterator n(G);n.isValid();++n)
46 if(Get(bfs.dist_map,n))
47 cout << *(Get(bfs.tree_map,n).From()) << "->"
48 << *(Get(bfs.tree_map,n).To())