ivy.layout_polar module¶
-
ivy.layout_polar.
calc_node_positions
(node, radius=1.0, pole=None, start=0, end=None, direction=1, scaled=False, n2coords=None)[source]¶ Calculate where nodes should be positioned in 2d space for drawing a polar tree
Parameters: - node (Node) – A (root) node
- radius (float) – The radius of the tree. Optional, defaults to 1
- pole (tuple) – Tuple of floats. The cartesian coordinate of the pole. Optional, defaults to None.
- end (float) – Where the tree ends. For best results, between 0 and 360. Optional, defaults to None.
- direction – CLOCKWISE or COUNTERCLOCKWISE. The direction the tree is drawn. Optional, defaults to COUNTERCLOCKWISE
- scaled (bool) – Whether or not the tree is scaled. Optional, defaults to False.
Returns: Mapping of nodes to Coordinates object
Return type:
-
ivy.layout_polar.
depth_length_preorder_traversal
(node, n2coords=None)[source]¶ Calculate node depth (root = depth 0) and length to root
Parameters: node (Node) – A node object. Returns: Mapping of nodes to coordinates instances. Coordinate instances have attributes “depth” and “length_to_root” Return type: dict