TryCalculateGraphMetrics
(
IGraph graph,
BackgroundWorker backgroundWorker,
out Nullable<Double> reciprocatedVertexPairRatio,
out Nullable<Double> reciprocatedEdgeRatio
)
{
Debug.Assert(graph != null);
if (graph.Directedness != GraphDirectedness.Directed)
{
reciprocatedVertexPairRatio = reciprocatedEdgeRatio = null;
}
else
{
HashSet<Int64> oVertexIDPairsOrdered, oVertexIDPairsUnordered;
CountEdges(graph, out oVertexIDPairsOrdered,
out oVertexIDPairsUnordered);
Int32 iVertexPairsWithBothDirectedEdges =
CountVertexPairsWithBothDirectedEdges(
graph, oVertexIDPairsOrdered);
reciprocatedVertexPairRatio = CalculateReciprocatedVertexPairRatio(
graph, iVertexPairsWithBothDirectedEdges,
oVertexIDPairsUnordered);
reciprocatedEdgeRatio = CalculateReciprocatedEdgeRatio(
graph, iVertexPairsWithBothDirectedEdges);
}
return (true);
}