Heap concept moved to namespace concept.
2 #include<concept/graph.h>
9 typedef ListGraph Graph;
10 //typedef Graph Graph;
13 Graph::OutEdgeIt safeFirstOut(const Graph &G, Graph::Node n)
15 return G.valid(n) ? Graph::OutEdgeIt(G,n):INVALID;
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;
33 for(int i=0;i<10;i++) G.addNode();
34 for(G.first(n);G.valid(n);G.next(n))
35 for(NodeIt m(G);m!=INVALID;G.next(m))
36 if(n!=m) G.addEdge(n,m);
38 OutEdgeIt e = safeFirstOut(G,n);
39 OutEdgeIt f = safeFirstOut(G,NodeIt(G));
42 InEdgeIt i(INVALID), j;
47 OutEdgeIt o(INVALID), oo;
52 EdgeIt ei(INVALID), eie;
63 tm = G.valid(n) && G.valid(i) && G.valid(o) && G.valid(ei);
65 std::vector<InEdgeIt> v(10);
66 std::vector<InEdgeIt> w(10,INVALID);
74 for(int i=0;i<10;i++) G.addNode();
75 for(NodeIt i(G);G.valid(i);G.next(i))
76 for(NodeIt j(G);G.valid(j);G.next(j))
77 if(i<j) G.addEdge(i,j); //The iterators are comparable
79 Graph::NodeMap<int> n(G);
81 for(NodeIt i(G);G.valid(i);G.next(i)) n[i]=count++;
83 Graph::NodeMap<int> nn=n;
84 Graph::NodeMap<double> dd=n;
90 Graph::EdgeMap<int> emap(G);
92 // Test of SymListGraph
95 typedef SymListGraph Graph;
96 typedef Graph::Edge Edge;
97 typedef Graph::InEdgeIt InEdgeIt;
98 typedef Graph::OutEdgeIt OutEdgeIt;
99 typedef Graph::EdgeIt EdgeIt;
100 typedef Graph::Node Node;
101 typedef Graph::NodeIt NodeIt;
105 for(int i=0;i<10;i++) G.addNode();
106 for(NodeIt i(G);G.valid(i);G.next(i))
107 for(NodeIt j(G);G.valid(j);G.next(j))
108 if(i<j) G.addEdge(i,j); //The iterators are comparable
110 Graph::EdgeMap<int> em(G);
111 Graph::SymEdgeMap<int> sm(G);
112 for(EdgeIt e(G);G.valid(e);G.next(e)) em[e]=G.id(e);
113 for(EdgeIt e(G);G.valid(e);G.next(e))
114 if(G.source(e)<G.target(e)) sm[e]=G.id(e);
116 for(EdgeIt e(G);G.valid(e);G.next(e))
117 std::cout << G.id(G.source(e)) << "->" << G.id(G.target(e))
118 << ": id=" << G.id(e) << " oppid=" << G.id(G.opposite(e))
120 << " sm=" << sm[e] << "\n";
124 while(G.valid(G.first(n))) G.erase(n);
127 // Tests for NodeSet and EdgeSet
132 typedef EdgeSet<NodeSet> ES;
136 for(int i=0;i<10;i++) G.addNode();
138 for(ES::NodeIt n(E);E.valid(n);E.next(n))
139 for(ES::NodeIt m(E);E.valid(m);E.next(m))
140 if(n!=m) F.addEdge(n,m);
141 for(ES::NodeIt n(F);F.valid(n);F.next(n))
142 for(ES::NodeIt m(F);F.valid(m);F.next(m))
143 if(n<m) F.addEdge(n,m);
146 NodeSet::NodeMap<int> nm1(N);
147 ES::NodeMap<int> nm2(E);
148 ES::EdgeMap<int> eme(E);
149 ES::EdgeMap<int> emf(F);