All faces of a planar graph

asked 2023-06-02 04:07:45 +0100

bobby.mir gravatar image

Is there any method to get all faces of a planar graph?

edit retag flag offensive close merge delete

Comments

Check method faces

sage: G = graphs.Grid2dGraph(3, 3)
sage: G.faces()
[[((0, 0), (0, 1)),
  ((0, 1), (0, 2)),
  ((0, 2), (1, 2)),
  ((1, 2), (2, 2)),
  ((2, 2), (2, 1)),
  ((2, 1), (2, 0)),
  ((2, 0), (1, 0)),
  ((1, 0), (0, 0))],
 [((0, 0), (1, 0)), ((1, 0), (1, 1)), ((1, 1), (0, 1)), ((0, 1), (0, 0))],
 [((0, 1), (1, 1)), ((1, 1), (1, 2)), ((1, 2), (0, 2)), ((0, 2), (0, 1))],
 [((1, 0), (2, 0)), ((2, 0), (2, 1)), ((2, 1), (1, 1)), ((1, 1), (1, 0))],
 [((1, 1), (2, 1)), ((2, 1), (2, 2)), ((2, 2), (1, 2)), ((1, 2), (1, 1))]]
David Coudert gravatar imageDavid Coudert ( 2023-06-02 08:06:17 +0100 )edit

How can I get the embedding? so how does the faces() work?

bobby.mir gravatar imagebobby.mir ( 2023-06-02 19:51:27 +0100 )edit

Run G.is_planar(set_embedding=True) followed by G.get_embedding().

John Palmieri gravatar imageJohn Palmieri ( 2023-06-03 00:32:15 +0100 )edit