I have a weighted graph on which I want to perform some FindShortestPath
calculations. However, the problem is that my weights are defined for vertices with VertexWeight
, but FindShortestPath
can only use edge weights defined with EdgeWeight
. For example, if I have a simple grid graph
g = GridGraph[{2, 2}, VertexWeight -> {1, 2, 1, 1}, VertexLabels -> "VertexWeight"]
and I compute the shortest path between the lower left and the upper right corner
FindShortestPath[g, 1, 4]
{1, 2, 4}
it would give me the path over the upper left vertex which is not what I want, because this vertex has a bigger weight than the vertex in the opposite corner. How can I calculate the shortest path with regard to vertex weights?
g
to get a edge-weighted graph forFindShortestPath
to work. $\endgroup$