I would like to implement a graph data structure in java to maintain a graph of objects. How should I achieve this? Is there a readily available library which could help?
I am implementing DAG and wondering whether the following is the only way to represent it in Java:
class Node{
List<Node> parents;
List<Node> successors;
int value; }
class DAG{
Node root; // assuming only one root …
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. …
Is there any standard Java library class to represent a tree in Java?
Specifically I need to represent the following:
The sub-tree at any node can have an arbitrary number of children
Each node (after the root) and it's children …