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 977553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:55:16+00:00 2026-05-16T03:55:16+00:00

UPDATE Some answers so far have suggested using an adjacency list. How would an

  • 0

UPDATE

Some answers so far have suggested using an adjacency list. How would an adjacency list look like in Java? … no pointers right 🙂


I’m trying to implement a Bipartite Graph in Java to sort into 2 groups information from a file. I found this example and it actually does the job:

http://users.skynet.be/alperthereal/source_files/html/java/Bipartite.java.html

However, I would like to implement my own version… if you look at a previous post of mine, you’d understand why I want to do this myself.

So I have to read a file from which I can get the number of vertices easily, but the number of edges not so easily. An example line would be “PersonA PersonB”, which can be read as “PersonA says PersonB”. So reading these lines…

"A says B"
"C says B"
"D says B"
"B says D"
"E says A & C"

… produces this grouping:

{A,D,C} and {B,E}.

How would I go about implementing this bipartite graph? What is a good resource for this task? What things (algorithms) should I be considering and thinking about when creating the BipartiteGraph class… perhaps traversing/sorting algorithms?

  • 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-05-16T03:55:16+00:00Added an answer on May 16, 2026 at 3:55 am

    It should be pretty straight forward to implement with an adjacency list. If it were an undirected bipartite graph I might suggest using an incidence matrix.

    So you’d have an array of linked lists then, or an array of some sort of dynamically allocated list, for each node. It should make adding edges fairly natural, for instance in your example you have an edge:

    Person A-> Person B

    Then you’d go the array index corresponding to Person A and push back the index corresponding to Persona B:

    [Person A]= Person B

    Then maybe you get another edge

    Persona A-> Person C

    Then your index there would look like:

    [Persona A]= Person B , Person C

    As one last example this would be the adjacency list for your example graph:

    [A] B

    [B] D

    [C] B

    [D] B

    [E] A,C

    Each index has a list of the nodes reachable from that node.

    ” What things (algorithms) should I be considering and thinking about when creating the BipartiteGraph class… perhaps traversing/sorting algorithms?”

    It really depends on what you want to do with the graph…

    For Reference: Similar Question with Code on Sun Forums

    adjacency-list-of-a-directed-weighted-graph

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

Sidebar

Related Questions

I would like to compare two tables and then update if some logic is
I have some update or something that tries to run every night, and ends
Looking through some code I came across the following code trTuDocPackTypdBd.update(TrTuDocPackTypeDto.class.cast(packDto)); and I'd like
I have some funny deadlock caused by a stupid simple SQL UPDATE query, on
How can I update some Windows Service Seperated Assemblies without restarting the service? Note:
I need to execute a select and then update some of the rows in
After some time I wanted to update my git repo, and then something went
I need some SQL to update a record in a database if it exists
I've been asked to implement some code that will update a row in a
I am considering adding validation on some insert and update statements for MS SQL

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.