graph theory in python