primo graph in python