I have the following structure:
config
|-- groups
|-- rootgroup
|-- group1 (includes rootgroup)
|-- group2 (includes group1)
|-- group3 (includes rootgroup)
|-- users
|-- Fred (includes group3 and group2)
So inheritance tree for Fred will look like:
_Fred_
v v
group2 group3
v v
group1 v
v /
rootgroup
I need an algorithm to print the linear config read order beginning at the bottom left of the tree (for given example it would be rootgroup - group1 - group2 - group3; group1 overwrites rootgroup, group2 overwrites group1, etc...) and find recursive links (for example if rootgroup includes group 2), moreover it must find the recursion loop (... -> group2 -> group1 -> rootgroup -> group2 -> ...).
Preferable language is python, but any will do.
Thanks.