This is a control flow graph, with an entry point(A), a body, and an exit point(H)
https://i.sstatic.net/rCb941kZ.png
I want to find all sub control flow graphs
In the graph I want to find:
Take this set [A2,B2,C2] as a whole node N, N has single input from exteral B to A2, and single output from C2 to external D2, and there is no other input/output node outside N connected to N
Is there any algorithms to do so? The algorithm should be able to find sub entry point and sub exit point pair properly, and find a proper set accordingly
I think that the first step here is to develop a clear and complete definition of what you mean by a "sub control flow graph".
As far as I can make out from your description
A sub control flow graph is a subset of the vertices and edges of a directed acyclic graph where:
Assuming you agree with this, then the original graph has to be searched for subgraphs that fit the definition.
remove original entry and exit points along with the edges connected to them.
identify all possible entry points in remaining graph
identify all possible exit points in remaining graph
loop over every pair of entry and exit points
Use yen's algorithm to find all the vertices between the current entry and exit points
if the in-between vertices are isolated from others ( bullets 3 and 4 of definition ) then add to list of sub control flow graphs