Path beween tree nodes, cost between edges differs in direction of traversal

I have a shortest-path problem and not sure what the right approach would be.

Given a tree, I would like to find the path and the path cost between two nodes, where the cost differs depending on the direction of traversal.

For example if A is a child node of B, A->B could have a cost of 3 and B->A has a cost of 4.

Is there a Java library where I can model this problem by setting up a graph with nodes and path costs in different directions as defined above, and have a way to get the path and path cost between two nodes?


ANSWERS:


There is a single path between each pair of nodes in a tree. Thus it doesn't really matter if prizes differ in the two directions - find the single path and then compute its prize in the two directions. Note that what you have is not a shortest path problem - you have a single path.



 MORE:


 ? Extending SimpleWeightedGraph - JgraphT
 ? JGraphT not using Name/Label providers in export
 ? import jgrapht package into my netbeans project
 ? JGraph - overriding cell drag
 ? Java: edit and recompile .jar?
 ? Java: .equals() failing for sets (JGraphT)
 ? Java: Why does this method have side effects?
 ? Java Code Review: Generate a subgraph
 ? Java: How does my Prim's look?
 ? Java: Prim's with Fibonacci heap? (JGraphT)