public Node AddArc(Node child, int weigth) { arcs.Add(new Arc(weigth, this, child)); if (!child.arcs.Exists(a => a.parent == child && a.child == this)) { child.AddArc(this, weigth); } return this; }
public Node CreateNode(string name) { Node node = new Node(name); nodes.Add(node); if (root == null) { root = node; } return node; }
public Arc(int weigth, Node parent, Node child) { this.weigth = weigth; this.parent = parent; this.child = child; }