title: Find subgraphs in a directed graph which are isolated by certain properties
body: <p>Please excuse my small knowledge of graph theory vocabulary.</p>
  
  <p>I can only describe the problem with common english words. Maybe someone can point me into the right direction and/or terms to look up.</p>
  
  <p>The problem came up as part of the implementation of a visual programming language. Where a vertex is a function/method and the edges transport data between the functions. Now there is the following problem:</p>
  
  <p>It could be allowed to connect the output of vertex A with the type of <em>Collection&lt; TItem ></em> to the input of vertex B with type <em>TItem</em>. And then the output of vertex B with type <em>TItem</em> to the input vertex C with type <em>Collection&lt; TItem ></em>. This would tell the compiler that it has to wrap a <em>foreach</em> function around vertex B to apply the function of B to each item in the collection from A and output the new items as collection to the input of C. So the edge from A to B is a many to one connection and from B to C is one to many.</p>
  
  <p>Now the actual problem is, what kind of algorithm would find a (directed) subgraph that is surrounded/isolated by one to many connections? so that the compiler would wrap a foreach function around this particular subgraph? I've tried to visualize the problem in this picture:</p>
  
  <p><img src="https://i.stack.imgur.com/Yivnt.png" alt="enter image description here"></p>