Exemple #1
0
 public Graph(int MaxSize, bool undirected)
 {
     size         = 0;
     this.maxSize = MaxSize;
     nodes        = new GraphNodeList <TN>(MaxSize);
     edges        = new EdgeList <TE>(MaxSize, undirected);
 }
 public Graph(GraphNodeList <T> nodeSet)
 {
     if (nodeSet == null)
     {
         this.nodeSet = new GraphNodeList <T>();
     }
     else
     {
         this.nodeSet = nodeSet;
     }
 }
Exemple #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Graph"/> class. 
 /// </summary>
 /// <param name="nodeSet">
 /// The node set. 
 /// </param>
 public Graph(GraphNodeList nodeSet)
 {
     this.nodeSet = this.nodeSet == null ? new GraphNodeList() : nodeSet;
 }
 public GraphNode(T data, GraphNodeList <T> neighbors)
 {
     this.data      = data;
     this.neighbors = neighbors;
 }
Exemple #5
0
        /// <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";
            }
        }