Graph path finding - creating an algorithm

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • johanes124
    New Member
    • Oct 2012
    • 1

    Graph path finding - creating an algorithm

    Hi,
    I have got problem with this task. (It's not homework!).
    We have undirected graph with wages X,Y.
    Firstly all edges has got X. But if exist path that costs 2X (from vi to vj and (vi and vj arent connected directly)) than we can replace it by Y.

    Our task is to find minimal distance to all vertex from start vertex.

    I will write an example:
    V E StartVertex, X, Y
    6 6 1 4 1
    1 2
    1 3
    1 6
    2 4
    3 5
    4 5

    out: (Distance from start vertex to i vertex).
    0
    2
    2
    1
    1
    3
Working...