{INT_MAX};
73std::vector<std::list<int> >
adj;
100 pair_u= std::vector<int>(
m+ 1,NIL);
104 pair_v= std::vector<int>(
n+ 1,NIL);
106 dist= std::vector<int>(
m+ 1);
114 for(
intu = 1; u <=
m; u++){
138 for(
intu = 1; u <=
m; u++)
165std::list<int>::iterator it;
166 for(it =
adj[u].begin(); it !=
adj[u].end(); ++it)
182 return(
dist[NIL] != INF);
195std::list<int>::iterator it;
196 for(it =
adj[u].begin(); it !=
adj[u].end(); ++it)
234 adj= std::vector<std::list<int> >(
m+ 1);
244 adj[u].push_back(v);
257 intv1a = 3, v1b = 5;
263 intexpected_res1 = 0;
266assert(res1 == expected_res1);
269 intv2a = 4, v2b = 4;
279 intexpected_res2 = 0;
282assert(res2 == expected_res2);
285 intv3a = 6, v3b = 6;
293 intexpected_res3 = 0;
296assert(res3 == expected_res3);
310 intv1 = 0, v2 = 0, e = 0;
311std::cin >> v1 >> v2 >> e;
314 for(
inti = 0; i < e; ++i)
320 intres = g.hopcroftKarpAlgorithm();
321std::cout <<
"Maximum matching is "<< res <<
"\n";
constexpr int64_t INF
for assert
Represents Bipartite graph for Hopcroft Karp implementation.
std::vector< std::list< int > > adj
adj[u] stores adjacents of left side and 0 is used for dummy vertex
void addEdge(int u, int v)
function to add edge from u to v
int m
m is the number of vertices on left side of Bipartite Graph
std::vector< int > dist
dist represents the distance between vertex 'u' and vertex 'v'
int n
n is the number of vertices on right side of Bipartite Graph
bool bfs()
This function checks for the possibility of augmented path availability.
std::vector< int > pair_u
value of vertex 'u' ranges from 1 to m
std::vector< int > pair_v
value of vertex 'v' ranges from 1 to n
int hopcroftKarpAlgorithm()
This function counts the number of augmenting paths between left and right sides of the Bipartite gra...
bool dfs(int u)
This functions checks whether an augmenting path is available exists beginning with free vertex u.
HKGraph()
Default Constructor for initialization.
int main()
Main function.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4