protected void ConnectNodeToNextLayer(NodeBase previousNode, PerceptronLayer nextLayer)
        {
            //Connect the edges...
            if (nextLayer == null)
            {
                return;
            }

            var nextPerceptrons = nextLayer.Nodes; //they are perceptrons

            foreach (var nextPerceptron in nextPerceptrons)
            {
                nextPerceptron.EdgesInternal.Add(Edge.Create(previousNode, nextPerceptron));
            }
        }
        public void Connect(PerceptronLayer nextLayer)
        {
            if (nextLayer == null) //Cut off the layer link
            {
                if (this.Next != null)
                {
                    this.Next.Previous = null; //cancel the Next's Previous layer (this)
                }

                this.Next = null;
                return;
            }

            if (this.Next != null)
            {
                this.Next.Previous = nextLayer;
                nextLayer.Next     = this.Next;
            }

            this.Next          = nextLayer;
            nextLayer.Previous = this;

            ConnectChild();
        }