I am not sure why you think I know what to do.
My guess (and it may be totally off) is that this will mostly be a problem in graph theory, since one bus cannot affect traffic flow in a meaningful way. I don't think I know enough graph theory for this, so it'll be interesting to see where this takes us!
I think maybe we should come up with some well-defined algorithm before we start programming. I will PM you (and maybe we could update the thread as/if progress is made).