AddOuterEdgesToSubgraph
(
Int32 iOuterLevel,
Dictionary<IVertex, Int32> oSubgraphVertices,
HashSet<IEdge> oSubgraphEdges
)
{
Debug.Assert(iOuterLevel > 0);
Debug.Assert(oSubgraphVertices != null);
Debug.Assert(oSubgraphEdges != null);
// Loop through the subgraph's vertices.
foreach (KeyValuePair<IVertex, Int32> oKeyValuePair in
oSubgraphVertices)
{
if (oKeyValuePair.Value != iOuterLevel)
{
continue;
}
IVertex oVertex = oKeyValuePair.Key;
// This is an outermost vertex. Loop through its incident edges.
foreach (IEdge oIncidentEdge in oVertex.IncidentEdges)
{
IVertex oAdjacentVertex =
oIncidentEdge.GetAdjacentVertex(oVertex);
Int32 iAdjacentVertexLevel;
// If the incident edge connects the outermost vertex to
// another outermost vertex in the subgraph, add the edge.
if (
oSubgraphVertices.TryGetValue(
oAdjacentVertex, out iAdjacentVertexLevel)
&&
iAdjacentVertexLevel == iOuterLevel
)
{
oSubgraphEdges.Add(oIncidentEdge);
}
}
}
}
}