Data Structure implement

  • Thread starter Thread starter dx
  • Start date Start date
D

dx

Perhaps it is not the correct place to ask this question (if any, please
tell me where is the correct place to ask this question)

1 -- 2 , 4
2 -- 1 , 5
3 -- 4 , 5
4 -- 1 , 3
5 -- 2 , 3

The number 1 to 5 above represents five different nodes, the number besides
means the possible next node . For example, if we want to go from 1 to 5, it
can be :

1 -> 2 -> 5
1 -> 4 -> 3 ->5

It is very easy to get the answer by look at the table. I want to implement
the above case by using VB.net, but I dont know what algorithm can be used.
Can anyone give me a suggestion ?
 
dx said:
Perhaps it is not the correct place to ask this question (if any, please
tell me where is the correct place to ask this question)

1 -- 2 , 4
2 -- 1 , 5
3 -- 4 , 5
4 -- 1 , 3
5 -- 2 , 3

The number 1 to 5 above represents five different nodes, the number besides
means the possible next node . For example, if we want to go from 1 to 5, it
can be :

1 -> 2 -> 5
1 -> 4 -> 3 ->5

It is very easy to get the answer by look at the table. I want to implement
the above case by using VB.net, but I dont know what algorithm can be used.
Can anyone give me a suggestion ?

This is a "Shortest Path" problem.

However this is a classical example of a problem which can quicky outstrip
your ability to compute it as the number of nodes increases.

Search google for "shortest path algorithm". There are many well known
approaches to this problem.

David
 
Back
Top