I have a directed graph with the following properties:
- Except for a few special progenitor nodes, every node has two parent nodes
- Any node can have any whole number of child nodes
- The graph is generated such that no node is a descendant of itself in the following way: I starting with a few progenitor nodes (which have no parents) then randomly select two nodes and create a "child" node with directed edges going from each parent to the child. I repeat that step an arbitrary number of times.
I'd like to find an algorithm to efficiently identify subgraphs with the following properties:
- The subgraph consists of two "parent" nodes and some or all of their descendants
- Except for the two "parent" nodes in the subgraph, each node has both parents also contained in the subgraph (that is, if the subgraph were separated from the rest of the graph, no node would be separated from its parents, except for the two "parent" nodes).
It's easy to find a 3-node example of this type of subgraph - just take any two nodes and one of their mutual children. However, I'd like to be able to efficiently identify larger examples of these subgraphs.
I'd really appreciate some help pointing me in the right direction. I thought that what I need might be related to finding "weakly connected components", but I haven't made much progress, and my inexperience with graph theory makes it hard to figure out what to search for. Thanks!
PS: I've provided an example depiction of one of these graphs