introducing entity-groups for using it in trees
implement tarjan for grouping the entities