Fixed a problem where edges going into a node were being
miscounted. This causes some subtle bugs.