Well, I think you are having trouble because I don't believe
Dijkstra's algorithm applies to your problem. Read below.
>
> OK so here is what I am thinking (I'm sorry this sort of thing is
> better with diagrams) but I will try my best:
>
> Given all the nodes above. We have edges AB, BC, BE, DB.
>
> Let's say they are weighted (in minutes) as
>
> AB = 5
> BC = 5
> BE = 7
> DB = 7
>
> (These are completely arbitrary)
>
> So lets say the train going from E-D leaves 9 minutes after the one
> from A to C. Does this mean I should calculate the node weight of B as
>
> sum of the route from E to B - sum of the route from A to B plus the
> number of minutes E to D departed after A to C.
>
> B = 7 - 5 + 9
>
> So a trip from A to D would be AB + B + BD or
>
> AD = 5 + 11 + 7
Yes. For your simple example, the time it takes to travel from A to D
would be 23 minutes as computed above. However, the value for B
computed above is not general and will change when considering other
solutions (for example traveling from A to D via transferring to a
different train that travels from C to D). In general, the value of B
is specific to the particular solution being examined.
> How does my shortest path algorithm know when to apply the node weight
> as this only happens when changing train?
Well, I don't think the Dijkstra algorithm applies here because of the
varying weights within the graph structure. Dijkstra applies to a
static graph with static weights for each of the elements in the
graph. Your graph is static, but your weights aren't. This is why I
mentioned a different method for computing an optimal solution in the
graph (which is what Dijkstra does for simpler problems).
> Thanks very much for your feedback, I guess this is probably a bit
> above my understanding so if it is not possible to explain or offer
> suggestions would you have any recommended reading for me. Thanks for
> pointing me towards http://en.wikipedia.org/wiki/Markov_chain_Monte_Carlo
> (well I hope thats what you meant!) I'm not so much concerned with
> optmizations, just wondering how it works in general.
I didn't mean the MCMC algorithm specifically. Just that you will
likely need a numeric approach to solve the optimization. Again,
Dijkstra is an algorithm that solves this optimization for a problem
unlike your own. You need another algorithm that solves your specific
optimization problem. Figuring out what algorithm you need is beyond
my free time. Good luck.