Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8613679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:56:29+00:00 2026-06-12T04:56:29+00:00

I have got a problem like this: We are given a bipartite graph. For

  • 0

I have got a problem like this:

We are given a bipartite graph. For e.g.

A1 B1
A2 B2
A3 B3
A4

And here is the adjacency list representation (assume graph is bidirectional)

B1 -> A2, A3
B2 -> A2, A3, A4
B3 -> A1

Final result should be that all nodes in the left side (As) have exactly 1 incoming edge and at the same time – we need to minimize the maximum number of edges that need to go out of individual Bs nodes. In this case the answer would be:

B3 can connect to A1
B2 can connect to A2, A4
B1 can connect to A3

So here the maximum number of edges that need to out of a single Bs node is 2. We cannot cover all As and at the same time have a B node not having 2 edges going out of it to cover As.

Another example:

A1 B1
A2 B2
A3 B3
A4 B4

B1 -> A1, A2, A3
B2 -> A1, A2, A3, A4
B3 -> A1, A2, A3
B4 -> A1, A2, A3

In this case the answer would be:

B1 can connect to A1
B2 can connect to A4
B3 can connect to A3
B2 can connect to A2

This way we will cover all the As exactly once and at the same time we have minimized the maximum number of edges that need to go out of individual B’s. So here the maximum number of edges that need to out of a single Bs node is 1.

Another example:

A1 B1
A2 B2
A3 B3
A4
A5
A6

B1 -> A6
B2 -> A1, A2, A3, A4, A5
B3 -> 

In this case the answer would be 5 i.e. the maximum number of edges that need to go out of a single Bs is 5. Can’t do less than that.

I have implemented basic ford fulkerson algorithm and I know this is also network flow but don’t know how to relate to it.

It will be great if someone can give some hint about the graph.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T04:56:30+00:00Added an answer on June 12, 2026 at 4:56 am

    Finding an optimal solution – with all B’s have at most one out edge (if one exists) is simple:

    • Add a source and a sink to the graph. The source will have an out
      edge with capacity 1 to all vertices on B’s list.
    • All (B,A) edges will have a capacity of 1.
    • All A’s will have an out edge with capacity 1 to the sink.
    • Now, running a flow algorithm will yield the maximal number of
      vertices in A that can be covered with each B having only a single
      out going edge (optimal solution, if one exists)

    EDIT:

    Now, based on the above idea, and since you are trying to minimize the maximum number of edges from a single B to A (and NOT the total number of them, as I previously thought), an optimal solution is simple:

    while there is no coverage:
       set capacity(source,b_k) = increase_size() (for each b_k in B)
       run max flow algorithm on the graph suggested above
    return last flow found
    

    Complexity is O(E*V*#iterations) (In this problem f <= V, thus the complexity if ford-fulkerson is O(EV)), where #iterations can be done linear in the minimal maximum number you seek, or using exponential increase, and then binary search on the range (as suggested by Evkeny Kluev), in log of this number.

    Since E=O(V) in bipartite graph, we get total of O(V^2*log(V))

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I' ve got a problem with Haskell. I have text file looking like this:
I have got very big problem because I would like to get more information
I have an object that looks like this. List<List<string>> MyData; The inner List<string> can
I have got a problem to get back a parameter from my view to
I have got a problem with calling a global function, which takes a pointer
I have got a strange problem about in_array recently which I cannot understand. e.g.
I have got a performance problem about TextField.htmlText +=msg .And I know that TextField.appendText(msg)
I have got a the following problem: I have got multi-step form where in
The problem is: I have got a table of columns (A, B, C) where
I have problem with context menu. I have got: @Override public void onCreateContextMenu(ContextMenu menu,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.