public override bool tryCalculate(IGraph graph, BackgroundWorker bgw, out VertexMetricBase metrics) { MetricDouble oMetrics; bool rv = TryCalculateGraphMetrics(graph, bgw, out oMetrics); metrics = oMetrics; return rv; }
public override bool tryCalculate(IGraph graph, BackgroundWorker bgw, out VertexMetricBase metrics) { MetricDouble oMetricDouble; bool rv = TryCalculateGraphMetrics(graph, bgw, out oMetricDouble); if (rv == true) metrics = oMetricDouble; else metrics = new MetricDouble(1); return rv; }
public Boolean TryCalculateGraphMetrics (IGraph graph, BackgroundWorker backgroundWorker, out VertexMetricBase graphMetrics) { Debug.Assert(graph != null); IVertexCollection oVertices = graph.Vertices; Int32 iVertices = oVertices.Count; Int32 iCalculations = 0; VertexDegrees oVertexIDDictionary = new VertexDegrees(iVertices); graphMetrics = oVertexIDDictionary; foreach (IVertex oVertex in oVertices) { // Check for cancellation and report progress every // VerticesPerProgressReport calculations. if ( (iCalculations % VerticesPerProgressReport == 0) && !ReportProgressAndCheckCancellationPending( iCalculations, iVertices, backgroundWorker) ) { return (false); } Int32 iInDegree, iOutDegree; CalculateVertexDegrees(oVertex, out iInDegree, out iOutDegree); oVertexIDDictionary.Add(oVertex.ID, iInDegree, iOutDegree); iCalculations++; } return (true); }
public abstract bool tryCalculate(IGraph graph, BackgroundWorker bgw, out VertexMetricBase metrics);