+ 1
How to make graph
i wanna know to to make weighted graph and how to search the shortest path
4 Réponses
+ 1
to make weighted graph you can use 2D array..!
ex. int G[5][5]
suppose you have node 1 and 2 with weight 30 the you can enter weight 30 into G[1][2] and G[2][1](if undirected).
like wise u have to enter all the weights and remaining elements should be very large like 9999.
for finding shortest path...
We have some algorithms
Dijkstra algo.
BellMan ford algo.
Floydwarshall algo.
you can implement one of them to find shortest path.(I recommend Dijkstra).
+ 1
okk, thanks
0
how ti make Dijkstra's algo?
0
you can get Dijkstra algo. online and implemt it as per your requirment in c++.