in src/main/java/org/apache/commons/graph/flow/DefaultMaxFlowAlgorithmSelector.java [169:191]
public void connect()
{
// vertices
for ( V vertex : graph.getVertices() )
{
addVertex( vertex );
}
// edges
for ( WE edge : graph.getEdges() )
{
VertexPair<V> edgeVertices = graph.getVertices( edge );
V head = edgeVertices.getHead();
V tail = edgeVertices.getTail();
addEdge( new EdgeWrapper<WE>( edge ) ).from( head ).to( tail );
if ( graph.getEdge( tail, head ) == null )
{
// complete the flow network with a zero-capacity inverse edge
addEdge( new EdgeWrapper<WE>() ).from( tail ).to( head );
}
}
}