TryCalculateGraphMetrics
(
IGraph graph,
CalculateGraphMetricsContext calculateGraphMetricsContext,
out GraphMetricColumn [] graphMetricColumns
)
{
Debug.Assert(graph != null);
Debug.Assert(calculateGraphMetricsContext != null);
AssertValid();
graphMetricColumns = null;
// Partition the graph into strongly connected components using the
// ConnectedComponentCalculator class in the Algorithms namespace,
// which knows nothing about Excel.
//
// Note that ConnectedComponentCalculator does its work synchronously.
Algorithms.ConnectedComponentCalculator oConnectedComponentCalculator =
new Algorithms.ConnectedComponentCalculator();
IList< LinkedList<IVertex> > oComponents =
oConnectedComponentCalculator.CalculateStronglyConnectedComponents(
graph, false);
// Convert the collection of components to an array of
// GraphMetricColumn objects.
graphMetricColumns =
GroupsToGraphMetricColumnsConverter.Convert< LinkedList<IVertex> >(
oComponents,
(oComponent) => oComponent
);
return (true);
}