41 checkConcept<ExtendableUndirGraph, UndirSmartGraph>(); |
41 checkConcept<ExtendableUndirGraph, UndirSmartGraph>(); |
42 |
42 |
43 checkConcept<UndirGraph, UndirGraph>(); |
43 checkConcept<UndirGraph, UndirGraph>(); |
44 } |
44 } |
45 |
45 |
46 typedef UndirListGraph Graph; |
46 template <typename Graph> |
47 typedef Graph::Node Node; |
|
48 typedef Graph::UndirEdge UEdge; |
|
49 typedef Graph::Edge Edge; |
|
50 typedef Graph::NodeIt NodeIt; |
|
51 typedef Graph::UndirEdgeIt UEdgeIt; |
|
52 typedef Graph::EdgeIt EdgeIt; |
|
53 |
|
54 void check_item_counts(Graph &g, int n, int e) { |
47 void check_item_counts(Graph &g, int n, int e) { |
55 check(countNodes(g)==n, "Wrong node number."); |
48 check(countNodes(g)==n, "Wrong node number."); |
56 check(countEdges(g)==2*e, "Wrong edge number."); |
49 check(countEdges(g)==2*e, "Wrong edge number."); |
57 } |
50 } |
58 |
51 |
|
52 template <typename Graph> |
59 void print_items(Graph &g) { |
53 void print_items(Graph &g) { |
|
54 |
|
55 typedef typename Graph::NodeIt NodeIt; |
|
56 typedef typename Graph::UndirEdgeIt UEdgeIt; |
|
57 typedef typename Graph::EdgeIt EdgeIt; |
|
58 |
60 cout << "Nodes" << endl; |
59 cout << "Nodes" << endl; |
61 int i=0; |
60 int i=0; |
62 for(NodeIt it(g); it!=INVALID; ++it, ++i) { |
61 for(NodeIt it(g); it!=INVALID; ++it, ++i) { |
63 cout << " " << i << ": " << g.id(it) << endl; |
62 cout << " " << i << ": " << g.id(it) << endl; |
64 } |
63 } |
79 << ")" << endl; |
78 << ")" << endl; |
80 } |
79 } |
81 |
80 |
82 } |
81 } |
83 |
82 |
84 int main() { |
83 template <typename Graph> |
85 check_concepts(); |
84 void check_graph() { |
86 |
85 |
|
86 typedef typename Graph::Node Node; |
|
87 typedef typename Graph::UndirEdge UEdge; |
|
88 typedef typename Graph::Edge Edge; |
|
89 typedef typename Graph::NodeIt NodeIt; |
|
90 typedef typename Graph::UndirEdgeIt UEdgeIt; |
|
91 typedef typename Graph::EdgeIt EdgeIt; |
87 |
92 |
88 Graph g; |
93 Graph g; |
89 |
94 |
90 check_item_counts(g,0,0); |
95 check_item_counts(g,0,0); |
91 |
96 |