Analyzer.VertexDegreeCalculator.CalculateVertexDegrees C# (CSharp) Method

CalculateVertexDegrees() protected method

protected CalculateVertexDegrees ( IVertex oVertex, Int32 &iInDegree, Int32 &iOutDegree ) : void
oVertex IVertex
iInDegree System.Int32
iOutDegree System.Int32
return void
        protected void CalculateVertexDegrees
            (IVertex oVertex, out Int32 iInDegree, out Int32 iOutDegree)
        {
            Debug.Assert(oVertex != null);

            iInDegree = 0;
            iOutDegree = 0;

            foreach (IEdge oIncidentEdge in oVertex.IncidentEdges)
            {
                IVertex[] aoVertices = oIncidentEdge.Vertices;

                // Test both of the edge's vertices so that a self-loop is properly
                // handled.

                if (aoVertices[0] == oVertex)
                {
                    iOutDegree++;
                }

                if (aoVertices[1] == oVertex)
                {
                    iInDegree++;
                }
            }
        }