GraphView.TranslateMatchClauseVisitor.GetMostExpensiveMatchComponent C# (CSharp) Method

GetMostExpensiveMatchComponent() private method

Gets the index and the average size per edege of the component with maximum average size
private GetMostExpensiveMatchComponent ( List components ) : double>.Tuple
components List
return double>.Tuple
        private Tuple<int, double> GetMostExpensiveMatchComponent(List<MatchComponent> components)
        {
            int index = 0;
            int edgeCount = components[0].EdgeMaterilizedDict.Count;
            edgeCount = edgeCount == 0 ? 1 : edgeCount;
            double maxValue = components[0].Cost/edgeCount;
            for (int i = 1; i < components.Count; i++)
            {
                edgeCount = components[i].EdgeMaterilizedDict.Count;
                edgeCount = edgeCount == 0 ? 1 : edgeCount;
                if (components[i].Cost/edgeCount > maxValue)
                {
                    index = i;
                    maxValue = components[i].Cost/edgeCount;
                }
            }
            return new Tuple<int, double>(index, maxValue);
        }