Fixed a tiny bug in the addEdge function