removing dependency of generateEdges on pymongo
print at the end of a cylce rather than the beginning