public List <int>[] GetConnectivityMap() { HashSet <GraphEdge> .Enumerator enumerator = new HashSet <GraphEdge> .Enumerator(); List <int>[] nums = new List <int> [checked (checked (this.Count - 1) + 1)]; int count = checked (this.Count - 1); for (int i = 0; i <= count; i = checked (i + 1)) { nums[i] = new List <int>(); } try { enumerator = this.Edges.GetEnumerator(); while (enumerator.MoveNext()) { GraphEdge current = enumerator.Current; if (!current.IsValid()) { continue; } nums[current.From].Add(current.To); nums[current.To].Add(current.From); } } finally { ((IDisposable)enumerator).Dispose(); } return(nums); }
public void PurgeEdges() { HashSet <GraphEdge> .Enumerator enumerator = new HashSet <GraphEdge> .Enumerator(); List <GraphEdge> graphEdges = new List <GraphEdge>(); try { enumerator = this.Edges.GetEnumerator(); while (enumerator.MoveNext()) { GraphEdge current = enumerator.Current; if (current.IsValid()) { continue; } graphEdges.Add(current); } } finally { ((IDisposable)enumerator).Dispose(); } int count = checked (graphEdges.Count - 1); for (int i = 0; i <= count; i = checked (i + 1)) { this.Edges.Remove(graphEdges[i]); } }