public GraphNode <T> AddNode(T value) { GraphNode <T> newNode = Nodes.FindByValue(value); if (newNode == null) { newNode = new GraphNode <T>(value); } Nodes.Add(newNode); return(newNode); }
public void AddNode(GraphNode <T> node) { // adds a node to the graph nodeSet.Add(node); }
/// <summary> /// The fill target vertex id combo box. /// </summary> private void FillTargetVertexIdComboBox() { var sourceVertex = (GraphNode)this.comboBoxSourceVertexId.SelectedItem; var graphNodeList = new GraphNodeList(); foreach (var node in this.provider.NetworkFlowGraph.Nodes) { if (node.VertexId.Equals(sourceVertex.VertexId)) { continue; } graphNodeList.Add(node); } foreach (var neighbour in sourceVertex.Neighbours) { GraphNode gnode = neighbour.NodeTo; if (graphNodeList.Contains(gnode)) { graphNodeList.Remove(gnode); } } this.comboBoxTargetVertexId.Items.Clear(); foreach (var node in graphNodeList) { this.comboBoxTargetVertexId.Items.Add(node); this.comboBoxTargetVertexId.DisplayMember = "VertexId"; } }