public void PrintOnScreen() { SungVertex <int> root = new SungVertex <int>(0); Enumerable.Range(1, 10).Select(a => root.To(new SungVertex <int>(a), a)); var vertices = root.Traverse(root); _output.WriteLine(vertices.ToString()); }
public IEnumerable <SungEdge <T> > Traverse(SungVertex <T> vertex) { foreach (var edge in vertex.Edges) { yield return(edge); foreach (var sungEdge in Traverse(edge.To)) { yield return(sungEdge); } } }
public SungEdge(SungVertex <T> to, int cost) { To = to; Cost = cost; }
public SungVertex <T> To(SungVertex <T> toVertex, int cost) { return(To(new SungEdge <T>(toVertex, cost))); }