private IEdge[] findPath(object from, object to, IEdge[] path) { if (from.Equals(to)) { return path; } foreach (var e in this.GetOutArcs(from)) { if (path == null || !path.Contains(e)) { List<IEdge> newPath = new List<IEdge>(); if (path != null) newPath = new List<IEdge>(path); newPath.Add(e); var res = this.findPath(e.Vertices[1].Value, to, newPath.ToArray()); if (res != null) return res; } } return null; }