Hi, everybody!
I am new to this forum.
I have a problem with an oriented weighted graph, more precisely, I have to find the shortest path between 2 nodes, but this path should pass through a given intermediary node. For example, I have a graph with 5 nodes, namely A, B, C, D, E. I have to find the shortest path from A to E, but this path should involve node C as well. With the weights the graph has, the shortest path should be, for example, A-B-D-E.
I used Dijkstra's algorithm to find the shortest path from A to E, that is the path A-B-D-E. That worked out fine. But I have no idea how I could change the code to accept the node that I am interested in, that is node C.
If you have any ideas, I would be very grateful to you.
Thanks a lot.