public static GraphEdge Connect(GraphNode from, GraphNode to, Graph graph) { if (!graph.Nodes.Contains(from) || !graph.Nodes.Contains(to)) { throw new ArgumentException(); } var edge = new GraphEdge(from, to); from.edges.Add(edge); to.edges.Add(edge); return(edge); }
public static void Disconnect(GraphEdge edge) { edge.To.edges.Remove(edge); edge.From.edges.Remove(edge); }
public void DeleteEdge(GraphEdge edge) { GraphNode.Disconnect(edge); }