Question: ( 5 pts . ) Determining if a graph is bipar te . A graph G = ( V , E ) is bipar te
pts Determining if a graph is biparte A graph G V E is biparte if its verces
can be paroned into two sets V and Vie V Vcup V and Vcap V so that
every edge has one endpoint in V and another endpoint in V Equivalently, G is biparte
if its verces can be colored red or blue so that every edge has one red endpoint and one
blue endpoint. V consists of the red verces while V the blue verces Many realworld
problems are modeled by biparte graphs for example, when matching employees to jobs,
V can represent the set of all employees, V the set of all jobs and there is an edge from an
employee to a job if the employee is qualified for the job.
a pt Explain why an odd cycle ie a cycle of odd length is not biparte and
why a graph that has an odd cycle as a subgraph is not biparte
Heres a standard way of determining if a given connected graph G is biparte: Starng at
some arbitrary node s run BFSG s Addionally record each node vs layer in the tree
as vlayer. That is if v in Li then vlayer i When BFSG s ends, go through every
edge. If some edge e uv is a cross edge and ulayer vlayer, return G is not a
biparte graph. Otherwise, if every cross edge does not sasfy this condion return G is
a biparte graph.
b pts Explain why the above algorithm is correct. That is argue that when the
algorithm returns G is not a biparte graph then G is indeed not a biparte graph.
On the other hand, when the algorithm returns G is a biparte graph then explain
why G is indeed a biparte graph. That is which verces should go to V and which
verces to V
c pts It is not difficult to check that the above algorithm runs in linear me ie
On mme This me around, describe a linear me algorithm that checks if a
connected graph is biparte or not based on DFS Please explain why your algorithm
is correct and why it runs in linear me
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
