[jgrapht-users] Algorithms for flow graphs
Brought to you by:
barak_naveh,
perfecthash
From: Joris K. <de...@gm...> - 2011-03-24 17:47:32
|
Hello, I'm about to build an algorithm for min-cost flow graphs. As you can imagine, this needs a flow graph which typically has the following properties: 1. Edges have a Capacity and a Cost 2. Vertices have a real postive/negative value indicating the demand/supply associated with each vertex. 3. The graph is directed Due to the generics in JgraphT I can easily create vertex/edge classes which maintain these values. There is however a problem with the currently existing algorithms in JgraphT. For example, in a flow graph, a shortest path is usually (or at least in my case) calculated using the edge costs as 'distances'. Furthermore, a max flow algorithm utilizes the edge capacities. When I would use org.jgrapht.alg.DijkstraShortestPath, the algorithm uses the getEdgeWeight(E edge) function to obtain the distances. Similarly, org.jgrapht.alg.EdmondsKarpMaximumFlow utilizes the getEdgeWeight(E edge) function to read the edge capacities. The getEdgeWeight(E edge) function can only return one value: either the edge capacity or the edge cost. What would be the cleanest way to resolve this issue (preferably something reusable by the jgrapht community)? |