Modify add_edge to incorporate vertices not yet added to the graph