I am trying to implement a directed weighted edge graph in Java using adjacency lists. It consists of an array with the size equal to the number of vertices, each entry of the array is a LinkedList
of the successors of that each particular Vertex
.
I want to add weight to each edge, I was thinking of doing this by adding a weight label to each successor
Object in the LinkedList
, furthermore I want to add other variables per Vertex
for future use. If I want to do this, I would have to create a new Data structure for the vertices and a separate one as an adjacency lists. What would be an efficient design to combine both as a single Data structure?