Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #A graph is called *cactus graph* if it is connected and every pair of
  2. simple cycles have at most one common vertex.
  3.  
  4. # Special cases
  5. if self.order() < 4: #Number of vertices
  6. return True
  7.  
  8. # Every cactus graph is outerplanar
  9. if not self.is_circular_planar():
  10. return False
  11.  
  12. if not self.is_connected():
  13. return False
  14.  
  15. # the number of faces is 1 plus the number of blocks of order > 2
  16. B = self.blocks_and_cut_vertices()[0]
  17. return len(self.faces()) == sum(1 for b in B if len(b) > 2) + 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement