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); }
GetUniqueEdgesByUser ( IGraph graph ) { Debug.Assert(graph != null); Dictionary <String, List <IEdge> > oUniqueEdgesByUser = new Dictionary <String, List <IEdge> >(); // Skip edges that correspond to the same status. foreach (IEdge oEdge in EdgeFilter.EnumerateEdgesByUniqueImportedID( graph.Edges)) { String sScreenName = oEdge.Vertex1.Name; if (!String.IsNullOrEmpty(sScreenName)) { List <IEdge> oUniqueEdgesForUser; if (!oUniqueEdgesByUser.TryGetValue( sScreenName, out oUniqueEdgesForUser)) { // This is the first edge for the user. oUniqueEdgesForUser = new List <IEdge>(); oUniqueEdgesByUser.Add( sScreenName, oUniqueEdgesForUser); } oUniqueEdgesForUser.Add(oEdge); } } return(oUniqueEdgesByUser); }