TryCalculateGraphMetrics
(
IGraph graph,
CalculateGraphMetricsContext calculateGraphMetricsContext,
out GraphMetricColumn [] graphMetricColumns
)
{
Debug.Assert(graph != null);
Debug.Assert(calculateGraphMetricsContext != null);
AssertValid();
graphMetricColumns = new GraphMetricColumn[0];
if (
graph.Directedness != GraphDirectedness.Directed
||
!calculateGraphMetricsContext.ShouldCalculateGraphMetrics(
GraphMetrics.ReciprocatedVertexPairRatio)
)
{
return (true);
}
// Calculate the metric for each vertex using the
// ReciprocatedVertexPairRatioCalculator class in the Algorithms
// namespace, which knows nothing about Excel.
Dictionary< Int32, Nullable<Double> > oReciprocatedVertexPairRatios;
if ( !( new Algorithms.ReciprocatedVertexPairRatioCalculator() ).
TryCalculateGraphMetrics(graph,
calculateGraphMetricsContext.BackgroundWorker,
out oReciprocatedVertexPairRatios) )
{
// The user cancelled.
return (false);
}
graphMetricColumns = new GraphMetricColumn [] {
CreateGraphMetricColumn(graph, oReciprocatedVertexPairRatios)
};
return (true);
}