Question:
You are given are a set of nodes that are connected to each other, each connection has a weighted value. Output the node to start from in order to achieve the greatest total weight. Each Node can only be "connected to" once: If the connection from node A to node B is used, no other connections TO node B can be used.
Multiple branches can also be possible.
A>B>C
A>D>F
If starting at A, both branches are traversed.
Given Info:
Number of nodes
Node connections with weights
Sample Input:
3//number of nodes
0, 1, 4//node connection with weight
0, 2, 1
1, 2, 3
-1//string to signify end of input
Sample Output:
Start at Node A with a total of 7.
I already have a working program that solves this but I just want to see how others would go about tackling this problem.
Are there any Objects or libraries in java that I'm not aware of that could make this simple?
