I'm looking to organize some items based on inheritance, with the goal of identifying which items are the most densely-connected parents, and also just seeing the connections formed.
Normally this would be done with a topological sort, but my graph has cycles. Is there something like a "best-effort" topological sort, which can attempt to determine the "most important" parents based on things like number of connections or something analogous?
As an example, given the graph below, I'd like for 1 and 2 to be the top-level parents. 1 has no parents; and while 2 is in a cycle, it is the parent of more children than it inherits from.
