Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ programing problem 27 Unweighted Bipartite Matching Time Limit: 2 seconds Problem Description For an undirected graph G=( V, E ), if the points on

C++ programing problem 27

Unweighted Bipartite

Matching

Time Limit: 2 seconds

Problem Description

For an undirected graph G=( V, E ), if the points on G can be divided into two groups, and the points in the group have no edges directly connected to each other,This p is called a bipartite graph.

Assuming that there is now a bipartite graph G, the points on G can be divided into X and Y groups. There is no direct connection between any two points in the group.

For point Xi in groupX and point Y in Y group, if there is edge connected Xi and Yj, matching can be performed, but only one point can be

Pairing to a point, means that there can be a point of no match, but no point can be matched to multiple points.

Find the max num of pair of matching at the same time.

Input File Format

There will be a positive integer N at the beginning, which means that there will be next N input data.

The first line of each input data has three positive integers x, y, and m. x and y represent the number of points in the X and Y groups, respectively, and m represents the number of edges.

1 ? x, y? 500 , 1 ? m ? 20000, points in groups X and Y are numbered 0 to x-1, 0 to y-1

The next m rows each have two positive integers a and b, which means that there is an edge between point a in the X group and point b in the Y group.

Output Format

The maximum matching number that can exist at the same time for each input data, and ends with newline

image text in transcribed

Example Sample Input Sample Output 3 5 7 0 1 10 12 13 23 2 4

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Current Trends In Database Technology Edbt 2006 Edbt 2006 Workshops Phd Datax Iidb Iiha Icsnw Qlqp Pim Parma And Reactivity On The Web Munich Germany March 2006 Revised Selected Papers Lncs 4254

Authors: Torsten Grust ,Hagen Hopfner ,Arantza Illarramendi ,Stefan Jablonski ,Marco Mesiti ,Sascha Muller ,Paula-Lavinia Patranjan ,Kai-Uwe Sattler ,Myra Spiliopoulou ,Jef Wijsen

2006th Edition

3540467882, 978-3540467885

More Books

Students also viewed these Databases questions