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.
If starting at A, both branches are traversed.
Number of nodes
Node connections with weights
3//number of nodes
0, 1, 4//node connection with weight
0, 2, 1
1, 2, 3
-1//string to signify end of input
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?