61 typedef ConstMap<Graph::Edge, int> Capacity; |
61 typedef ConstMap<Graph::Edge, int> Capacity; |
62 Capacity capacity(1); |
62 Capacity capacity(1); |
63 |
63 |
64 Graph::EdgeMap<int> flow(graph); |
64 Graph::EdgeMap<int> flow(graph); |
65 |
65 |
66 Preflow<Graph, int, Capacity> preflow(graph, source, target, capacity, flow); |
66 Preflow<Graph, Capacity> preflow(graph, capacity, source, target); |
67 |
67 |
68 preflow.run(); |
68 preflow.run(); |
69 |
69 |
70 cout << "Number of edge disjoint paths: " << preflow.flowValue() << endl; |
70 cout << "Number of edge disjoint paths: " << preflow.flowValue() << endl; |
71 |
71 |
72 graphToEps(graph, "edge_disjoint_paths.eps"). |
72 graphToEps(graph, "edge_disjoint_paths.eps"). |
73 title("edge disjoint paths").scaleToA4(). |
73 title("edge disjoint paths").scaleToA4(). |
74 copyright("(C) 2003-2007 LEMON Project").drawArrows(). |
74 copyright("(C) 2003-2007 LEMON Project").drawArrows(). |
75 edgeColors(composeMap(functorMap(color), flow)). |
75 edgeColors(composeMap(functorMap(color), preflow.flowMap())). |
76 coords(coords).run(); |
76 coords(coords).run(); |
77 |
77 |
78 |
78 |
79 cout << "The paths are written into edge_disjoint_paths.eps" << endl; |
79 cout << "The paths are written into edge_disjoint_paths.eps" << endl; |
80 |
80 |
85 typedef ConstMap<SGraph::Edge, int> SCapacity; |
85 typedef ConstMap<SGraph::Edge, int> SCapacity; |
86 SCapacity scapacity(1); |
86 SCapacity scapacity(1); |
87 |
87 |
88 SGraph::EdgeMap<int> sflow(sgraph); |
88 SGraph::EdgeMap<int> sflow(sgraph); |
89 |
89 |
90 Preflow<SGraph, int, SCapacity> spreflow(sgraph, SGraph::outNode(source), |
90 Preflow<SGraph, SCapacity> spreflow(sgraph, scapacity, |
91 SGraph::inNode(target), |
91 SGraph::outNode(source), |
92 scapacity, sflow); |
92 SGraph::inNode(target)); |
93 |
93 |
94 spreflow.run(); |
94 spreflow.run(); |
95 |
95 |
96 cout << "Number of node disjoint paths: " << spreflow.flowValue() << endl; |
96 cout << "Number of node disjoint paths: " << spreflow.flowValue() << endl; |
97 |
97 |
98 |
98 |
99 graphToEps(sgraph, "node_disjoint_paths.eps"). |
99 graphToEps(sgraph, "node_disjoint_paths.eps"). |
100 title("node disjoint paths").scaleToA4(). |
100 title("node disjoint paths").scaleToA4(). |
101 copyright("(C) 2003-2007 LEMON Project").drawArrows(). |
101 copyright("(C) 2003-2007 LEMON Project").drawArrows(). |
102 edgeColors(composeMap(functorMap(color), sflow)). |
102 edgeColors(composeMap(functorMap(color), spreflow.flowMap())). |
103 coords(SGraph::combinedNodeMap(coords, |
103 coords(SGraph::combinedNodeMap(coords, |
104 shiftMap(coords, |
104 shiftMap(coords, |
105 dim2::Point<double>(5, 0)))). |
105 dim2::Point<double>(5, 0)))). |
106 run(); |
106 run(); |
107 |
107 |