diff --git a/d2/d48/max__flow__with__ford__fulkerson__and__edmond__karp__algo_8cpp_source.html b/d2/d48/max__flow__with__ford__fulkerson__and__edmond__karp__algo_8cpp_source.html
index 6a5d3d1cf..6c353f6a8 100644
--- a/d2/d48/max__flow__with__ford__fulkerson__and__edmond__karp__algo_8cpp_source.html
+++ b/d2/d48/max__flow__with__ford__fulkerson__and__edmond__karp__algo_8cpp_source.html
@@ -145,95 +145,94 @@ $(function(){initNavTree('d2/d48/max__flow__with__ford__fulkerson__and__edmond__
- 30 bool is_path_found =
false;
- 31 while (q.empty() ==
false && is_path_found ==
false) {
- 32 int current_node = q.front();
- 33 visited.set(current_node);
-
- 35 for (
int i = 0; i < total_nodes; ++i) {
- 36 if (residual_capacity[current_node][i] > 0 && !visited[i]) {
-
- 38 parent[i] = current_node;
-
-
-
-
-
-
-
-
-
-
-
-
- 51 std::cin >> total_nodes >> total_edges >> source >> sink;
- 52 parent = std::vector<int>(total_nodes, -1);
- 53 capacity = residual_capacity = std::vector<std::vector<int> >(
- 54 total_nodes, std::vector<int>(total_nodes));
- 55 for (
int start = 0, destination = 0, capacity_ = 0, i = 0;
- 56 i < total_edges; ++i) {
- 57 std::cin >> start >> destination >> capacity_;
- 58 residual_capacity[start][destination] = capacity_;
- 59 capacity[start][destination] = capacity_;
-
-
- 62 void ford_fulkerson() {
- 63 while (bfs(source, sink)) {
- 64 int current_node = sink;
- 65 int flow = std::numeric_limits<int>::max();
- 66 while (current_node != source) {
- 67 int parent_ = parent[current_node];
- 68 flow = std::min(flow, residual_capacity[parent_][current_node]);
- 69 current_node = parent_;
-
-
-
- 73 while (current_node != source) {
- 74 int parent_ = parent[current_node];
- 75 residual_capacity[parent_][current_node] -= flow;
- 76 residual_capacity[current_node][parent_] += flow;
- 77 current_node = parent_;
-
-
-
- 81 void print_flow_info() {
- 82 for (
int i = 0; i < total_nodes; ++i) {
- 83 for (
int j = 0; j < total_nodes; ++j) {
-
- 85 residual_capacity[i][j] < capacity[i][j]) {
- 86 edge_participated.emplace_back(std::make_tuple(
- 87 i, j, capacity[i][j] - residual_capacity[i][j]));
-
-
-
- 91 std::cout <<
"\nNodes : " << total_nodes <<
"\nMax flow: " << max_flow
- 92 <<
"\nEdge present in flow: " << edge_participated.size()
-
- 94 std::cout <<
"\nSource\tDestination\tCapacity\total_nodes";
- 95 for (
auto& edge_data : edge_participated) {
- 96 int source = 0, destination = 0, capacity_ = 0;
- 97 std::tie(source, destination, capacity_) = edge_data;
- 98 std::cout << source <<
"\t" << destination <<
"\t\t" << capacity_
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 115 graph.ford_fulkerson();
- 116 graph.print_flow_info();
-
-
+ 30 while (q.empty() ==
false) {
+ 31 int current_node = q.front();
+ 32 visited.set(current_node);
+
+ 34 for (
int i = 0; i < total_nodes; ++i) {
+ 35 if (residual_capacity[current_node][i] > 0 && !visited[i]) {
+
+ 37 parent[i] = current_node;
+
+
+
+
+
+
+
+
+
+
+
+
+ 50 std::cin >> total_nodes >> total_edges >> source >> sink;
+ 51 parent = std::vector<int>(total_nodes, -1);
+ 52 capacity = residual_capacity = std::vector<std::vector<int> >(
+ 53 total_nodes, std::vector<int>(total_nodes));
+ 54 for (
int start = 0, destination = 0, capacity_ = 0, i = 0;
+ 55 i < total_edges; ++i) {
+ 56 std::cin >> start >> destination >> capacity_;
+ 57 residual_capacity[start][destination] = capacity_;
+ 58 capacity[start][destination] = capacity_;
+
+
+ 61 void ford_fulkerson() {
+ 62 while (bfs(source, sink)) {
+ 63 int current_node = sink;
+ 64 int flow = std::numeric_limits<int>::max();
+ 65 while (current_node != source) {
+ 66 int parent_ = parent[current_node];
+ 67 flow = std::min(flow, residual_capacity[parent_][current_node]);
+ 68 current_node = parent_;
+
+
+
+ 72 while (current_node != source) {
+ 73 int parent_ = parent[current_node];
+ 74 residual_capacity[parent_][current_node] -= flow;
+ 75 residual_capacity[current_node][parent_] += flow;
+ 76 current_node = parent_;
+
+
+
+ 80 void print_flow_info() {
+ 81 for (
int i = 0; i < total_nodes; ++i) {
+ 82 for (
int j = 0; j < total_nodes; ++j) {
+
+ 84 residual_capacity[i][j] < capacity[i][j]) {
+ 85 edge_participated.emplace_back(std::make_tuple(
+ 86 i, j, capacity[i][j] - residual_capacity[i][j]));
+
+
+
+ 90 std::cout <<
"\nNodes : " << total_nodes <<
"\nMax flow: " << max_flow
+ 91 <<
"\nEdge present in flow: " << edge_participated.size()
+
+ 93 std::cout <<
"\nSource\tDestination\tCapacity\total_nodes";
+ 94 for (
auto& edge_data : edge_participated) {
+ 95 int source = 0, destination = 0, capacity_ = 0;
+ 96 std::tie(source, destination, capacity_) = edge_data;
+ 97 std::cout << source <<
"\t" << destination <<
"\t\t" << capacity_
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 114 graph.ford_fulkerson();
+ 115 graph.print_flow_info();
+
+
diff --git a/da/d9a/class_graph.html b/da/d9a/class_graph.html
index 03ba256c9..fe94abb04 100644
--- a/da/d9a/class_graph.html
+++ b/da/d9a/class_graph.html
@@ -681,24 +681,23 @@ Private Attributes
27 visited.reset();
28 std::queue<int> q;
29 q.push(source);
- 30 bool is_path_found = false;
- 31 while (q.empty() == false && is_path_found == false) {
- 32 int current_node = q.front();
- 33 visited.set(current_node);
- 34 q.pop();
- 35 for (int i = 0; i < total_nodes; ++i) {
- 36 if (residual_capacity[current_node][i] > 0 && !visited[i]) {
- 37 visited.set(i);
- 38 parent[i] = current_node;
- 39 if (i == sink) {
- 40 return true;
- 41 }
- 42 q.push(i);
- 43 }
- 44 }
- 45 }
- 46 return false;
- 47 }
+ 30 while (q.empty() == false) {
+ 31 int current_node = q.front();
+ 32 visited.set(current_node);
+ 33 q.pop();
+ 34 for (int i = 0; i < total_nodes; ++i) {
+ 35 if (residual_capacity[current_node][i] > 0 && !visited[i]) {
+ 36 visited.set(i);
+ 37 parent[i] = current_node;
+ 38 if (i == sink) {
+ 39 return true;
+ 40 }
+ 41 q.push(i);
+ 42 }
+ 43 }
+ 44 }
+ 45 return false;
+ 46 }
@@ -725,26 +724,26 @@ Private Attributes
-
Definition at line 62 of file max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp.
-
62 {
-
63 while (bfs(source, sink)) {
-
64 int current_node = sink;
-
65 int flow = std::numeric_limits<int>::max();
-
66 while (current_node != source) {
-
67 int parent_ = parent[current_node];
-
68 flow = std::min(flow, residual_capacity[parent_][current_node]);
-
69 current_node = parent_;
-
70 }
-
71 current_node = sink;
-
72 max_flow += flow;
-
73 while (current_node != source) {
-
74 int parent_ = parent[current_node];
-
75 residual_capacity[parent_][current_node] -= flow;
-
76 residual_capacity[current_node][parent_] += flow;
-
77 current_node = parent_;
-
78 }
-
79 }
-
80 }
+
Definition at line 61 of file max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp.
+
61 {
+
62 while (bfs(source, sink)) {
+
63 int current_node = sink;
+
64 int flow = std::numeric_limits<int>::max();
+
65 while (current_node != source) {
+
66 int parent_ = parent[current_node];
+
67 flow = std::min(flow, residual_capacity[parent_][current_node]);
+
68 current_node = parent_;
+
69 }
+
70 current_node = sink;
+
71 max_flow += flow;
+
72 while (current_node != source) {
+
73 int parent_ = parent[current_node];
+
74 residual_capacity[parent_][current_node] -= flow;
+
75 residual_capacity[current_node][parent_] += flow;
+
76 current_node = parent_;
+
77 }
+
78 }
+
79 }
@@ -832,28 +831,28 @@ Private Attributes
-
Definition at line 81 of file max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp.
-
81 {
-
82 for (int i = 0; i < total_nodes; ++i) {
-
83 for (int j = 0; j < total_nodes; ++j) {
-
84 if (capacity[i][j] &&
-
85 residual_capacity[i][j] < capacity[i][j]) {
-
86 edge_participated.emplace_back(std::make_tuple(
-
87 i, j, capacity[i][j] - residual_capacity[i][j]));
-
88 }
-
89 }
-
90 }
-
91 std::cout << "\nNodes : " << total_nodes << "\nMax flow: " << max_flow
-
92 << "\nEdge present in flow: " << edge_participated.size()
-
93 << '\n';
-
94 std::cout << "\nSource\tDestination\tCapacity\total_nodes";
-
95 for (auto& edge_data : edge_participated) {
-
96 int source = 0, destination = 0, capacity_ = 0;
-
97 std::tie(source, destination, capacity_) = edge_data;
-
98 std::cout << source << "\t" << destination << "\t\t" << capacity_
-
99 << '\t';
-
100 }
-
101 }
+
Definition at line 80 of file max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp.
+
80 {
+
81 for (int i = 0; i < total_nodes; ++i) {
+
82 for (int j = 0; j < total_nodes; ++j) {
+
83 if (capacity[i][j] &&
+
84 residual_capacity[i][j] < capacity[i][j]) {
+
85 edge_participated.emplace_back(std::make_tuple(
+
86 i, j, capacity[i][j] - residual_capacity[i][j]));
+
87 }
+
88 }
+
89 }
+
90 std::cout << "\nNodes : " << total_nodes << "\nMax flow: " << max_flow
+
91 << "\nEdge present in flow: " << edge_participated.size()
+
92 << '\n';
+
93 std::cout << "\nSource\tDestination\tCapacity\total_nodes";
+
94 for (auto& edge_data : edge_participated) {
+
95 int source = 0, destination = 0, capacity_ = 0;
+
96 std::tie(source, destination, capacity_) = edge_data;
+
97 std::cout << source << "\t" << destination << "\t\t" << capacity_
+
98 << '\t';
+
99 }
+
100 }
@@ -880,19 +879,19 @@ Private Attributes
-
Definition at line 50 of file max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp.
-
50 {
-
51 std::cin >> total_nodes >> total_edges >> source >> sink;
-
52 parent = std::vector<int>(total_nodes, -1);
-
53 capacity = residual_capacity = std::vector<std::vector<int> >(
-
54 total_nodes, std::vector<int>(total_nodes));
-
55 for (int start = 0, destination = 0, capacity_ = 0, i = 0;
-
56 i < total_edges; ++i) {
-
57 std::cin >> start >> destination >> capacity_;
-
58 residual_capacity[start][destination] = capacity_;
-
59 capacity[start][destination] = capacity_;
-
60 }
-
61 }
+
Definition at line 49 of file max_flow_with_ford_fulkerson_and_edmond_karp_algo.cpp.
+
49 {
+
50 std::cin >> total_nodes >> total_edges >> source >> sink;
+
51 parent = std::vector<int>(total_nodes, -1);
+
52 capacity = residual_capacity = std::vector<std::vector<int> >(
+
53 total_nodes, std::vector<int>(total_nodes));
+
54 for (int start = 0, destination = 0, capacity_ = 0, i = 0;
+
55 i < total_edges; ++i) {
+
56 std::cin >> start >> destination >> capacity_;
+
57 residual_capacity[start][destination] = capacity_;
+
58 capacity[start][destination] = capacity_;
+
59 }
+
60 }