private void RemoveVertex(DateVertex v) { // We want to enforce the re-assignment of cycles _cycles = null; v = _verteces.Find(v1 => v.Key == v1.Key); if(null != v) { _verteces.Remove(v); _edges.Remove(v.Key); foreach (var key in _edges.Keys) { var list = _edges[key]; int index = 0; while(index < list.Count) { var e = list[index]; if(e.V1.Key == v.Key || e.V2.Key == v.Key) { list.Remove(e); --index; } ++index; } } } }
internal List<DateVertex> GetAdjustentVerteces(DateVertex vertex) { var list = new List<DateVertex>(); GetEdges(vertex.Key).ForEach(e => list.Add(e.V2)); return list; }
private DateVertex GetVertex(string key) { DateVertex v = _verteces.Find(vx => vx.Key == key); if (null == v) { v = new DateVertex(key); _verteces.Add(v); } return v; }
private static List<List<DateVertex>> Traverse(DateVertex startingVertex) { _stack.Clear(); _g.Verteces.ToList().ForEach(v => v.Visited = false); _target = startingVertex.Key; _stack.Push(startingVertex); startingVertex.Visited = true; MakeAVisit(); return _cycles; }