Search for a child in a structure and write the parent hierarchy to csv

Hi smart people,

I need some help with a task I’m stuck with.

In my example attached I have two tables of data.
One table (Search table (parent child structure) ) contain a parent child hierarch where Column 1 is the lowest child and Column 2 to Column 7 is the hierarchy.
The other table contain children that for some reason is not a lowest child in the data (even if they should be that at one point).

My need is to build that missing hierarchy using the “search table”.

I have added a “Wanted output” to show what I’m hoping for.

Any idea how to do that?
Finding the children in the “values” table was easy. Finding the hierarchy and writing it has been harder.

Thanks in advance

KnimeQuestion.xlsx (11.0 KB)

Hello @LostInTheFlood,
I’m not sure I understand very well but I looked a little. First make the graph with the search table :

The only sink nodes (no outgoing edge) are F, G, H, I, J. A, B, C, D are not.

Then use this usefull component All Routes Between Nodes – KNIME Community Hub (thanks @takbb !) to search all paths.
You can look for the end node of each path. There is some questions : there are several solutions for the wanted result. What can be the best choice ?
For example, A considered as child, has this path 1, 2, A but 5, 6, A too :
image

child_parent.knwf (125,7 Ko)

Hope this could help !
Best,
Joel

2 Likes