Computer scienceAlgorithms and Data StructuresAlgorithmsGraph algorithmsShortest path algorithms

Bellman–Ford algorithm

Helping Bob

Report a typo

Bob is a successful entrepreneur. He is working on a very important project and needs to make some decisions. Therefore, he drew a graph where nodes represent activities. A directed edge is drawn between two nodes if and only if the accomplishment of an activity depends on the completion of the other one. Weights are the costs of transiting from one activity to another; if negative, it means Bob earns more than he spends. His graph looks like this:

the shortest path in the graph

Help Bob calculate the most profitable sequence of activities in order to perform activity 66. In other words, write the space-separated ordered array of nodes in the shortest path from node 11 to node 66.

Answer format example: 1 2 3 4 5 6

Enter a short text
___

Create a free account to access the full topic