How do I apply DFS (Depth FIrst Search)? - C #

0

I have to apply the DFS algorithm (depth first search) taking into account that I have the following vertices

  

Alpha, Beta, Gamma, Delta, Epsilon, Zeta, Eta, Theta, Iota, Kappa

and I have the following edges in a matrix

  

0.76000,0,20000,0,0,0,0,0,0

     

76000,0,0,0,240000,0,0,0,360000,0

     

0,0,0,10000,0,0,0,120000,0,360000

     

20000,0,10000,0,0,0,0,0,0,0

     

0,240000,0,0,0,0,60000,0,0,0

     

0,0,0,0,0,0,30000,0,120000,0

     

0,0,0,0,60000,30000,0,0,0,0

     

0.0,120000,0,0,0,0,0,0,0,180000

     

0.360000,0,0,0,120000,0,0,0,0

     

0.0,360000,0,0,0,0,180000,0,0

As far as I could understand, I made the graph to be able to check results, according to me the graph would have to have the following structure

Then they ask me to carry out a program that gives me

1- All roads from an origin to a destination (the origin and destination is entered by the user).

2- All the vertices that are at a given distance from a source vertex (the distance is given by the value of the edges for example of the Alpha to Delta there is a value of 20000).

    
asked by Shiki 01.12.2017 в 06:28
source

0 answers