void CreateGraph(Node <Student> current, Vertix parent, Point location, Rectangle canvasSize, List <Vertix> n, List <Edge> e) { Vertix v = new Vertix(current.key.ToString(), current.color, location); n.Add(v); if (parent != null) { e.Add(new Edge(parent, v)); } if (current.left != null) { CreateGraph(current.left, v, new Point((int)(location.X - canvasSize.Width / Math.Pow(2, CountDepthNode(tree.GetRoot, current.left, 1))), location.Y + canvasSize.Height / depthTree), canvasSize, n, e); } else { NILVertix nv = new NILVertix(new Point((int)(location.X - canvasSize.Width / Math.Pow(2, CountDepthNode(tree.GetRoot, current, 1) + 1)), location.Y + canvasSize.Height / depthTree)); n.Add(nv); e.Add(new Edge(v, nv)); } if (current.right != null) { CreateGraph(current.right, v, new Point((int)(location.X + canvasSize.Width / Math.Pow(2, CountDepthNode(tree.GetRoot, current.right, 1))), location.Y + canvasSize.Height / depthTree), canvasSize, n, e); } else { NILVertix nv = new NILVertix(new Point((int)(location.X + canvasSize.Width / Math.Pow(2, CountDepthNode(tree.GetRoot, current, 1) + 1)), location.Y + canvasSize.Height / depthTree)); n.Add(nv); e.Add(new Edge(v, nv)); } }
public Edge(Vertix _begin, Vertix _end) { begin = _begin; end = _end; }