private bool AddNeighborsToEachOther(ListGraphNode <TNode> node1, ListGraphNode <TNode> node2)
        {
            var node2AddedToNode1Successfully = node1.AddNeighbor(node2);
            var node1AddedToNode2Successfully = node2.AddNeighbor(node1);

            return(node2AddedToNode1Successfully && node1AddedToNode2Successfully);
        }
        private bool RemoveNeighborsFromEachOther(ListGraphNode <TNode> node1, ListGraphNode <TNode> node2)
        {
            var node2RemovedFromNode1Successfully = node1.RemoveNeighbor(node2);
            var node1RemovedFromNode2Successfully = node2.RemoveNeighbor(node1);

            return(node2RemovedFromNode1Successfully && node1RemovedFromNode2Successfully);
        }
 public bool AddNeighbor(ListGraphNode <TNode> neighbor)
 {
     if (neighbors.Contains(neighbor))
     {
         return(false);
     }
     else
     {
         neighbors.Add(neighbor);
         return(true);
     }
 }
 public bool RemoveNeighbor(ListGraphNode <TNode> neighbor)
 => neighbors.Remove(neighbor);