simplified the code of the complete graph