layout_circle_packing#
Layout functions for drawing a planar graph.
- layout_circle_packing(k, rotation=0.0, return_circles=False)#
Computes the layout using circle packing for a given planar or oriented planar diagram. A layout is a dictionary, where keys are diagram elements (nodes, arcs, endpoints, faces) and values are the corresponding geometric objects (e.g., points, segments, circle arcs) which, upon plotting, will represent the diagram.
- Parameters:
k (PlanarDiagram | OrientedPlanarDiagram) – The input planar or oriented planar diagram representing the knot or link for which the layout is calculated.
rotation (float) – The rotation angle in degrees by which the layout should be rotated.
return_circles (bool) – If True, the function also returns the computed circles for the circle packing. Defaults to False.
- Returns:
dict or tuple – If return_circles is False, the function returns a dictionary mapping nodes, endpoints, arcs, and faces to their corresponding layout positions. If return_circles is True, it returns a tuple containing the layout dictionary and the computed circles.