Implementation of Hopcroft–Karp algorithm.
The Hopcroft–Karp algorithm is an algorithm that takes as input a bipartite graph and produces as output a maximum cardinality matching, it runs in O(E√V) time in worst case.
-
+
Bipartite graph
A bipartite graph (or bigraph) is a graph whose vertices can be divided into two disjoint and independent sets U and V such that every edge connects a vertex in U to one in V. Vertex sets U and V are usually called the parts of the graph. Equivalently, a bipartite graph is a graph that does not contain any odd-length cycles.
-
+
Matching and Not-Matching edges
Given a matching M, edges that are part of matching are called Matching edges and edges that are not part of M (or connect free nodes) are called Not-Matching edges.
-
+
Maximum cardinality matching
Given a bipartite graphs G = ( V = ( X , Y ) , E ) whose partition has the parts X and Y, with E denoting the edges of the graph, the goal is to find a matching with as many edges as possible. Equivalently, a matching that covers as many vertices as possible.
-
+
Augmenting paths
Given a matching M, an augmenting path is an alternating path that starts from and ends on free vertices. All single edge paths that start and end with free vertices are augmenting paths.
-
+
Concept
A matching M is not maximum if there exists an augmenting path. It is also true other way, i.e, a matching is maximum if no augmenting path exists.
-
+
Algorithm
1) Initialize the Maximal Matching M as empty. 2) While there exists an Augmenting Path P Remove matching edges of P from M and add not-matching edges of P to M (This increases size of M by 1 as P starts and ends with a free vertex i.e. a node that is not part of matching.) 3) Return M.
- Author
- Krishna Pal Deora
diff --git a/d1/d9a/hopcroft__karp_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.map b/d1/d9a/hopcroft__karp_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.map
index 7bc349182..a8732e2aa 100644
--- a/d1/d9a/hopcroft__karp_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.map
+++ b/d1/d9a/hopcroft__karp_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.map
@@ -1,9 +1,9 @@
diff --git a/d1/d9a/hopcroft__karp_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.svg b/d1/d9a/hopcroft__karp_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.svg
index 00bf2f3e1..52ff7691a 100644
--- a/d1/d9a/hopcroft__karp_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.svg
+++ b/d1/d9a/hopcroft__karp_8cpp_a88ec9ad42717780d6caaff9d3d6977f9_cgraph.svg
@@ -1,7 +1,7 @@
-