Smrf.NodeXL.ExcelTemplate.GroupEdgeSorter.SortGroupEdges C# (CSharp) Method

SortGroupEdges() public static method

public static SortGroupEdges ( IGraph graph, Int32 maximumGroups, System.Boolean includeDummyGroupForEntireGraph, System.Boolean includeDummyGroupForUngroupedEdges ) : List
graph IGraph
maximumGroups System.Int32
includeDummyGroupForEntireGraph System.Boolean
includeDummyGroupForUngroupedEdges System.Boolean
return List
    SortGroupEdges
    (
        IGraph graph,
        Int32 maximumGroups,
        Boolean includeDummyGroupForEntireGraph,
        Boolean includeDummyGroupForUngroupedEdges
    )
    {
        Debug.Assert(graph != null);
        Debug.Assert(maximumGroups > 0);

        // Filter out duplicate edges.

        IEnumerable<IEdge> oFilteredEdges =
            EdgeFilter.FilterEdgesByImportedID(graph.Edges);

        // Sort the filtered edges by group.

        List<GroupEdgeInfo> oGroupEdgeInfos =
            SortFilteredEdgesByGroup(graph, maximumGroups, oFilteredEdges);

        if (includeDummyGroupForUngroupedEdges)
        {
            // This option makes sense only if all groups were asked for.

            Debug.Assert(maximumGroups == Int32.MaxValue);

            // Append a GroupEdgeInfo object that contains the edges that are
            // not contained in any real groups.

            oGroupEdgeInfos.Add(

                new GroupEdgeInfo(
                    GetUngroupedEdges(oFilteredEdges, oGroupEdgeInfos),
                    DummyGroupNameForUngroupedEdges)
                    );
        }

        if (includeDummyGroupForEntireGraph)
        {
            // Insert a GroupEdgeInfo object that contains all the graph's
            // edges.  Note that this must be the first item in the returned
            // collection.

            oGroupEdgeInfos.Insert(0,

                new GroupEdgeInfo(oFilteredEdges,
                    DummyGroupNameForEntireGraph)
                    );
        }

        return (oGroupEdgeInfos);
    }