title: DAG shortest path with weight on vertex/node in Java
body: <p><a href="https://i.stack.imgur.com/6mGrc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6mGrc.png" alt="weighted pie chart"></a>This is a slight variation on many existing algorithms, whereby topological sort seems to be the most obvious and efficient answer.</p>
  
  <p>Lets take an example to explain more clearly what I mean.</p>
  
  <p>I have a DAG starting at vertex A with 5 vertex/nodes to E.   I want to find the shortest path from A to E such that each node itself is weighted along with the path, at some point there is the possibility each node could have more than 1 weighted value.  The Nodes could have many variables, such as x, y and z.  These inputs are weighted based on some preference for example user preference.  So y could we be weighted more heavily than x or z and this takes into account the "shorter" path.</p>
  
  <p>I have attached an image to explain what I want to do.  What's the best way of achieving this?  The reason for adding weight to nodes, is preference of a particular node by a given input.</p>
  
  <p>In the pie chart we can see that Y is weighted most heavily with 50% preference, therefore we would Y*N where N is the number to calculate weight.  In D in the attached Graph, x, y z would be {1, 0.6, 0.3}   </p>
  
  <p>Edit: Based on original answer, updating the description.  Simplified the diagram and added a new pie chart to explain the weighting.</p>