I want to calculate ownership in a group of company represented as a graph. This graph contains cycles (when two companies own each other). I\'ve been trying different solutions