data structures - How do I implement a Bipartite Graph in Java? -


update

Some answers have been suggested to use an adjacent list yet. How does an adjacent list appear in Java? ... there is no correct indication :)


I am trying to apply a Bipartite graph in Java to sort 2 groups of information from a file. I found this example and it actually works:

However, I want to apply my own version ... if you see one, you Understand why I want to do it myself

So I have to read that file so that I can easily get the number of Shiromani, but the number of edges is not so easily received. An example line would be "Person A Pursbeee" , which can be read as "" Persona is Personal Person ", then read these lines ..." "B" is called "B" "D says B" "B is called D" "E says A & C"

... produces this group:

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

How would I have to go about implementing this bilateral graph? What is a good resource for this task? What algorithms should I consider and think when the bipartitegraph is making the class ... perhaps trafficking / sorting algorithms?

It should be very straight forward to apply with proximity list. If this was an indirect bilateral graph, then I could suggest using an event matrix.

So you have an array of linked lists, or for each array of any kind of dynamically assigned list, for each node. For example, in your example you have an edge:

person A-> person B

Then you press the index of person A and Persona B.:

< = person B

Then you get another advantage

Personality -> C

Then your index will look like this: / P>

[personality A] = person B, person C

As a last example, this will be a proximity list. Example: Graph:

[A] B

[B] d

[c] b

[d] b

[e] a, c

each index accessible from that node There is a list of nodes.

"What things (algorithms) should I consider and think when Bipartitegraph is building orbit ... perhaps trafficking / sorting algorithms?"

Do it really with what the graph depends on you ...

For reference:

< / Html>

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -