BipatiteMatching

struct BipatiteMatching {
int L;
int R;
int count;
int[][] g;
int[] lmt;
int[] rmt;
int[] visited;
int vc;
}

Members

Functions

addEdge
void addEdge(size_t l, size_t r)

add edge(l, r)

cngLeftVertexEdge
void cngLeftVertexEdge(size_t l, in int[] v)

cng left_l's edge

delEdge
void delEdge(size_t l, size_t r)

del edge(l, r)

Examples

1 auto bm = BipatiteMatching(3, 3);
2 bm.addEdge(0, 0);
3 bm.addEdge(0, 1);
4 bm.addEdge(1, 1);
5 bm.addEdge(2, 1);
6 assert(bm.count == 2); // example: (0, 0), (1, 1)
7 bm.addEdge(1, 2);
8 assert(bm.count == 3); // (0, 0), (1, 2), (2, 1)
9 bm.delEdge(2, 1);
10 assert(bm.count == 2); // example: (0, 0) (1, 2)

Meta