Python

Linked items to a Tree

Let’s say you receive a list of 2 linked items having a “is included in” relation.

For example, you receive this list :

Here ('cpqswcc', 'compaq') means 'cpqswcc' is included in 'compaq'. You may want to build a relation tree like this :

The cool function to do that would be the one in this code :