Example #1
0
        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());
        }
Example #2
0
        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);
                }
            }
        }
Example #3
0
 public SungEdge(SungVertex <T> to, int cost)
 {
     To   = to;
     Cost = cost;
 }
Example #4
0
 public SungVertex <T> To(SungVertex <T> toVertex, int cost)
 {
     return(To(new SungEdge <T>(toVertex, cost)));
 }