i have this DAG (it is similar to a binary tree, but it is a graph.. has this a specified name?):

(each number is a node and numbers in the node are for example, the program should run with random numbers)
it is represented as a list of list:
[[1],[2,3],[4,5,6]]
i have to find in the more functional way as possible the path that maximize the sum of nodes:
[1,3,6]
i’ve searched and this is really similar to projecteuler #18, but project euler asks the hole sum of the path, and in my homework i have to find not only the sum but all nodes.
i’ve tried to adapt some really good solutions to my problem but i didn’t managed to.
some advice?
As I understand your problem, node of depth n and rank r at that level will be connected to nodes of level n+1 with rank r and r+1.
The direct path is certainly to look for some recurrence relation using some search function that will take one of your dags as input. You can certainly start by just looking for the max weight, when this works also building the list of nodes should not be a big problem.
I had it working following this path, the code and the test sets I used are below… but I removed the most interesting part to avoid spoiling the subject. I can give you some more hint if necessary. That’s only to get you started.