TestCalculateStronglyConnectedComponents6()
{
// N components with 1-N vertices each, sort ascending.
const Int32 Components = 100;
Int32[][] aiiVertexIDs = new Int32[Components][];
// Add the components in decreasing order to test component sorting.
for (Int32 iComponent = Components - 1; iComponent >= 0; iComponent--)
{
Int32 iVertices = iComponent + 1;
Int32[] aiVertexIDs = new Int32[iVertices];
aiiVertexIDs[iComponent] = aiVertexIDs;
IVertex oFirstVertex = null;
for (Int32 i = 0; i < iVertices; i++)
{
IVertex oVertex = m_oVertices.Add();
aiVertexIDs[i] = oVertex.ID;
if (i == 0)
{
oFirstVertex = oVertex;
}
else
{
m_oEdges.Add(oFirstVertex, oVertex);
}
}
}
IList<LinkedList<IVertex>> oStronglyConnectedComponents =
m_oConnectedComponentCalculator.
CalculateStronglyConnectedComponents(m_oGraph, true);
Assert.AreEqual(Components, oStronglyConnectedComponents.Count);
Int32 j = 0;
foreach (LinkedList<IVertex> oStronglyConnectedComponent in
oStronglyConnectedComponents)
{
CheckThatComponentConsistsOfVertices(
oStronglyConnectedComponent, aiiVertexIDs[j]);
j++;
}
}