Re: Shortest Path



On Feb 27, 12:02 pm, "Ez_Alg" <virtualreal...@xxxxxxxxx> wrote:
Hi Everyone,
Can you guide me through the following problem:
in the shortest path problem if we have vertex costs in addition to
edge lengths how is the algorithm changed! I am trying to modify the
Dijkstra and Bellman_ford algorithm to answer this but i am stuck!!!
any Hints

I assume that the path weight is the sum of the edge weights plus the
sum of the vertex weights.

You can solve this by running a standard shortest path algorithm
on the following modified graph. Split each vertex V with weight W
into two vertices V1 and V2, and add a directed edge V1 ---> V2
of weight W.

Case 1: Your initial graph is directed.
For each directed edge U ---> V of weight W in your initial graph,
have a directed edge U2 ---> V1 of weight W in your new graph.

Case 2: Your initial graph is undirected.
For each edge U --- V of weight W, have directed edges U2 ---> V1
and V2 ---> U1 both of weight W.

Now to find the shortest path from X to Y in your initial graph,
find the shortest path from X1 to Y2 in your modified graph.
If you don't want to include the weight of the initial vertex in your
total path weight, then start from vertex X2 instead.

-- Glenn C. Rhoads



.



Relevant Pages

  • Re: Shortish paths
    ... For how many nodes and how many edges will the actual algorithm run ... original graph. ... optimal solution is removed from the graph, ... I intend to begin by rereading the shortest path sections of Cormen ...
    (comp.theory)
  • Re: Shortish paths
    ... original graph. ... The functionality of Dijkstra's original algorithm can be extended ... optimal solution is removed from the graph, ... I intend to begin by rereading the shortest path sections of Cormen ...
    (comp.theory)
  • Re: Shortish paths
    ... Remember I'm not asking for an algorithm, just for advice on what to ... original graph. ... optimal solution is removed from the graph, ... I intend to begin by rereading the shortest path sections of Cormen ...
    (comp.theory)
  • Re: Graph Algorithm Question
    ... is there an algorithm to do the following: ... However the graph should contain no directed ... cycle whose weight is negative. ... If all the edges weighs are positive then shortest path from X to X is ...
    (comp.theory)
  • Re: Graph optimization
    ... represented in the form of a graph. ... I have to add up all the weights to form the ... algorithm is going to be the best for finding the shortest path ...
    (comp.programming)