Analyzer.PageRankCalculator.calculateVertexPageRank C# (CSharp) Method

calculateVertexPageRank() private method

private calculateVertexPageRank ( IVertexCollection vertices, Double>.Dictionary oldPageRanks, Double>.Dictionary &newPageRanks ) : void
vertices IVertexCollection
oldPageRanks Double>.Dictionary
newPageRanks Double>.Dictionary
return void
        private void calculateVertexPageRank(IVertexCollection vertices, Dictionary<Int32, Double> oldPageRanks, out Dictionary<Int32, Double> newPageRanks)
        {
            newPageRanks = new Dictionary<Int32, Double>(vertices.Count);
            foreach(IVertex node in vertices){
                ICollection<IVertex> adjacentNodes = node.AdjacentVertices;
                double newRank = (1 - damping_factor) / vertices.Count;
                foreach (IVertex adjNode in adjacentNodes) {
                    double adjNodeRank;
                    oldPageRanks.TryGetValue(adjNode.ID, out adjNodeRank);
                    newRank += damping_factor * adjNodeRank / adjNode.AdjacentVertices.Count;
                }
                newPageRanks.Add(node.ID, newRank);
            }
        }