private static int GetNodeCount()

in src/dotnet/PowerToys.CyclomaticComplexity/ComplexityAnalysisElementProblemAnalyzer.cs [202:217]


    private static int GetNodeCount(IEnumerable<IControlFlowEdge> edges)
    {
      var hasNullDestination = false;

      var nodes = new HashSet<IControlFlowElement>();
      foreach (var edge in edges)
      {
        nodes.Add(edge.Source);

        if (edge.Target != null)
          nodes.Add(edge.Target);
        else
          hasNullDestination = true;
      }
      return nodes.Count + (hasNullDestination ? 1 : 0);
    }