Using Math.Pow to compute maxNumEdges. ^ is a logical XOR operator, not a power as in other languages.