public void AddRoad(int length, City c1, City c2) //добавить дорогу { Road road = new GenericGraph.Road(length); road.Connections[0] = c1; road.Connections[1] = c2; MainGraph.AddEdge(road, c1, c2); }
private void BtnAddEdge_Click(object sender, RoutedEventArgs e) { try { Edge newEdge = new Edge(MainGraphName + _MainGraph.EdgeCollection.Count().ToString(), SelectedStartPoint, SelectedEndPoint); MainGraph.AddEdge(newEdge); NotifyPropertyChanged("MainGraph"); TaskAnswer = GraphUtils.IsDirectedTree(MainGraph); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка добавления"); } }