Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

networkx.algorithms.planar_drawing.combinatorial_embedding_to_pos

combinatorial_embedding_to_pos(embedding, fully_triangulate=False)[source]

Assigns every node a (x, y) position based on the given embedding

The algorithm iteratively inserts nodes of the input graph in a certain order and rearranges previously inserted nodes so that the planar drawing stays valid. This is done efficiently by only maintaining relative positions during the node placements and calculating the absolute positions at the end. For more information see [1].

Parameters:
  • embedding (nx.PlanarEmbedding) – This defines the order of the edges
  • fully_triangulate (bool) – If set to True the algorithm adds edges to a copy of the input embedding and makes it chordal.
Returns:

pos – Maps each node to a tuple that defines the (x, y) position

Return type:

dict

References

[1]M. Chrobak and T.H. Payne: A Linear-time Algorithm for Drawing a Planar Graph on a Grid 1989 http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.51.6677