views:

64

answers:

1

Hello,

I wanted to simulate a railway network where there would be stations, trains and routes connecting each station. So how do you think I should attempt to model this?? I thought of using graphs taking station as vertex and edges as routes. Also since there will be tens of trains and stations and hence hundreds of routes so should I model the database as a graph in mysql or should I write create a php program containing the graph which retrieves info from the database?

I am a relatively beginner programmer and be glad with some help as I am very confused at this moment. Any other better idea is also welcome.

A: 

You're going to want to use Dijkstra's algorithm for this. I know there are stored procedures online (to create the database of stations) somewhere I just can't find them right now. Should help you get started though.

Galen
who said he wanted to do any kind of efficient routing?
twolfe18
like i said there are stored procedures online that will help him with his issue if he looks for dijkstra's algo. i just can't find him right now.
Galen
Obviously I would need dijkstra put the problem as I said is should I model the database as a graph?? or create a graph design in php and then retrieve it from a database??
5lackp1x3l0x17