Python: Girvan Newman implemented