Came accross a question, bellow is a simplified version of it:
There are a few nodes of the graph given where each node is associated with a specified weight. To travel from node 1 to node 2, it takes some prescribed time. We need to traverse the node starting from node A, and return back on it within 24 time units. Find the maximum total weight that can be carried. Also, calculate the time taken.
Assume that the connections/edges are bidirectional.
Example:
Node:Weight
A:0,B:4,C:5,D:6
Edge: time taken
A-B:2,B-C:10,C-D:1
Output: 9:24 Max Weight: time taken
Explaination: The only way you can travel is A <-> B <-> C <-> D
one can start from A -> B -> C -> D -> C -> B -> A
While you would had time to visit the D node, you can't make back in time to the base(A) if you're doing so. You'll need to head home(A) after visiting C.
Example 2:
A:0,B:3,C:4,D:5
AB:1,BC:9,BD:1
output: 12:22
In this example, you can visit all nodes and return in 22 time units to your starting point while picking up all 12 weights.