/// <summary> /// Checks if a connection between 2 nodes already exists. /// This check is directional, this means that ConnectionExists(a,b) is not the same as ConnectionExists(b,a). /// </summary> /// <param name="startNode">The start node.</param> /// <param name="endNode">The end node.</param> /// <returns>Returns <c>true</c> if there is a connection that goes from the start node to the end node; otherwise, <c>false</c>.</returns> private bool ConnectionExists(Node startNode, Node endNode) { return(ConnectionGenes.Any(gene => gene.InNode.Id.Equals(startNode.Id) && gene.OutNode.Id.Equals(endNode.Id))); }
/// <summary> /// Checks if a connection between 2 nodes already exists. /// This check is directional, this means that ConnectionExists(a,b) is not the same as ConnectionExists(b,a). /// </summary> /// <param name="startNode">The start node.</param> /// <param name="endNode">The end node.</param> /// <returns>Returns <c>true</c> if there is a connection that goes from the start node to the end node; otherwise, <c>false</c>.</returns> private bool ConnectionExists(Node startNode, Node endNode) { return(ConnectionGenes.Any(gene => gene.InId == startNode.Id && gene.OutId == endNode.Id)); }