Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #A graph is called *cactus graph* if it is connected and every pair of
- simple cycles have at most one common vertex.
- # Special cases
- if self.order() < 4: #Number of vertices
- return True
- # Every cactus graph is outerplanar
- if not self.is_circular_planar():
- return False
- if not self.is_connected():
- return False
- # the number of faces is 1 plus the number of blocks of order > 2
- B = self.blocks_and_cut_vertices()[0]
- 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