removing edges and nodes before generating any codes