bugfix: reinplace self-loop node with 0 fails

In-place node replacement uses a Boolean formula instead of the ternary operator to check whether the edge being replaced is a self-loop. As a result, if the new node is 0, then the replacement fails partially, because it adds an edge from the old to the new node, instead of self-loop on the new node. Thus both the old and new node remain in the graph returned from `networkx.replace_nodes` with `copy=False`.

For more details, please see the commit messages.