1 | #include <iostream> |
---|

2 | |
---|

3 | #include <lemon/list_graph.h> |
---|

4 | #include <lemon/smart_graph.h> |
---|

5 | #include <merge_node_graph_wrapper.h> |
---|

6 | |
---|

7 | using std::cout; |
---|

8 | using std::endl; |
---|

9 | |
---|

10 | using namespace lemon; |
---|

11 | |
---|

12 | class Graph3 : ListGraph { |
---|

13 | public: |
---|

14 | class Node : public ListGraph::Node { }; |
---|

15 | class Edge { }; |
---|

16 | }; |
---|

17 | |
---|

18 | int main() { |
---|

19 | typedef SmartGraph Graph1; |
---|

20 | typedef ListGraph Graph2; |
---|

21 | Graph1 g; |
---|

22 | Graph2 h; |
---|

23 | typedef MergeNodeGraphWrapper<Graph1, Graph2> GW; |
---|

24 | GW gw(g, h); |
---|

25 | Graph1::Node n1=g.addNode(); |
---|

26 | Graph1::Node n2=g.addNode(); |
---|

27 | Graph1::Node n3=g.addNode(); |
---|

28 | Graph2::Node n4=h.addNode(); |
---|

29 | Graph2::Node n5=h.addNode(); |
---|

30 | //GW::NodeIt n(gw) |
---|

31 | for (GW::NodeIt n(gw); n!=INVALID; ++n) { |
---|

32 | cout << gw.id(n) << endl; |
---|

33 | } |
---|

34 | |
---|

35 | GW::NodeMap<int> nm(gw); |
---|

36 | int i=0; |
---|

37 | for (GW::NodeIt n(gw); n!=INVALID; ++n) { |
---|

38 | ++i; |
---|

39 | nm.set(n, i); |
---|

40 | } |
---|

41 | for (Graph1::NodeIt n(g); n!=INVALID; ++n) { |
---|

42 | cout << nm[n] << endl; |
---|

43 | } |
---|

44 | for (Graph2::NodeIt n(h); n!=INVALID; ++n) { |
---|

45 | cout << nm[n] << endl; |
---|

46 | } |
---|

47 | |
---|

48 | gw.print(); |
---|

49 | |
---|

50 | { |
---|

51 | // typedef SmartGraph Graph1; |
---|

52 | typedef ListGraph Graph1; |
---|

53 | typedef ListGraph Graph2; |
---|

54 | Graph1 g; |
---|

55 | Graph2 h; |
---|

56 | typedef MergeNodeGraphWrapper<Graph1, Graph2> GW; |
---|

57 | GW gw(g, h); |
---|

58 | gw.print(); |
---|

59 | } |
---|

60 | { |
---|

61 | // typedef SmartGraph Graph1; |
---|

62 | typedef Graph3 Graph1; |
---|

63 | typedef ListGraph Graph2; |
---|

64 | Graph1 g; |
---|

65 | Graph2 h; |
---|

66 | typedef MergeNodeGraphWrapper<Graph1, Graph2> GW; |
---|

67 | GW gw(g, h); |
---|

68 | gw.print(); |
---|

69 | } |
---|

70 | { |
---|

71 | // typedef SmartGraph Graph1; |
---|

72 | typedef ListGraph Graph1; |
---|

73 | typedef Graph3 Graph2; |
---|

74 | Graph1 g; |
---|

75 | Graph2 h; |
---|

76 | typedef MergeNodeGraphWrapper<Graph1, Graph2> GW; |
---|

77 | GW gw(g, h); |
---|

78 | gw.print(); |
---|

79 | } |
---|

80 | } |
---|