Пример #1
0
        public static GraphEdge Connect(GraphNode from, GraphNode to, Graph graph, int weight)
        {
            if (!graph.Nodes.Contains(from) || !graph.Nodes.Contains(to))
            {
                throw new ArgumentException();
            }

            var edge = new GraphEdge(from, to, weight);

            from.edges.Add(edge);
            to.edges.Add(edge);

            return(edge);
        }
Пример #2
0
 public static void Disconnect(GraphEdge edge)
 {
     edge.To.edges.Remove(edge);
     edge.From.edges.Remove(edge);
 }
Пример #3
0
 public void DeleteEdge(GraphEdge edge)
 {
     GraphNode.Disconnect(edge);
 }