hello,
I m working on a Ford-Fulkerson algorithm to get the Maximum flow in residual graph, and min-cost algorithm.
My representation based on adjacency-lists approach, where I keep track of all the vertices connected to each vertex on a linked list that is associated with that vertex.
So far I've created 4 classes:
Edge( int cost , int capacity )
+public int getCost()
+public void setCost(int c)
+public int getCapacity()
+public void setCapacity(int c)
Vertex( String nm )
+public String getName()
+public void setName(String name)
Node(Vertex v, Edge e)
+public Vertex getVertex()
+public Edge getEdge()
Graph, and contains // not programmed yet
removeEdge
addEdge
removeVertex
AddVertex
getEdgeCapacity(Vertex sourceVertex,Vertex targetVertex)
getEdgeCost(Vertex sourceVertex,Vertex targetVertex)
my problem is how to add node linked list associated to a specified vertex to my graph. Do I have to create a multidimensional vector(2d) that hold Vertex name in first column and linked list in second column?
And I want to know is this the right implementation for this algorithm.
regards