mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-04-07 04:30:06 +08:00
Merge branch 'master' into patch-3
This commit is contained in:
@@ -63,6 +63,8 @@ class BGraph
|
||||
int m, n;
|
||||
const int NIL;
|
||||
const int INF;
|
||||
|
||||
|
||||
// adj[u] stores adjacents of left side
|
||||
// vertex 'u'. The value of u ranges from 1 to m.
|
||||
// 0 is used for dummy vertex
|
||||
@@ -224,9 +226,16 @@ bool BGraph::dfs(int u)
|
||||
BGraph::BGraph():NIL(0),INF(INT_MAX)
|
||||
{}
|
||||
|
||||
// Default Constructor for initialization
|
||||
BGraph::BGraph(){
|
||||
NIL=0;
|
||||
INF=INT_MAX;
|
||||
}
|
||||
|
||||
// Constructor for initialization
|
||||
BGraph::BGraph(int m, int n):NIL(0),INF(INT_MAX)
|
||||
{
|
||||
this->BGraph();
|
||||
this->m = m;
|
||||
this->n = n;
|
||||
adj = std::vector<std::list<int> >(m + 1);
|
||||
@@ -238,22 +247,6 @@ void BGraph::addEdge(int u, int v)
|
||||
adj[u].push_back(v); // Add v to u’s list.
|
||||
}
|
||||
|
||||
/*
|
||||
Test case :
|
||||
Input:
|
||||
// vertices of left and right side and total edges
|
||||
// B-Graph shown in the above example
|
||||
4 4 6
|
||||
1 1
|
||||
1 3
|
||||
2 3
|
||||
3 4
|
||||
4 3
|
||||
4 2
|
||||
Output:
|
||||
// size of maximum matching
|
||||
Maximum matching is 4
|
||||
*/
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user