SugiyamaLayout
- class omni.kit.widget.graph.graph_layout.SugiyamaLayout(edges=[], vertical_distance=10.0, horizontal_distance=10.0)
Bases:
object
Compute the coordinates for drawing directed graphs following the method developed by Sugiyama.
This method consists of four phases: 1. Cycle Removal 2. Layer Assignment 3. Crossing Reduction 4. Coordinate Assignment
As input it takes the list of edges in the following format: [(vertex1, vertex2), (vertex3, vertex4), … ]
Once the object is created, it’s possible to get the node layer number immediately.
To get the node positions, it’s necessary to set each node’s size and call `update_positions`.
Follows closely to the following papers: [1] “An Efficient Implementation of Sugiyama’s Algorithm for Layered Graph Drawing” Eiglsperger Siebenhaller Kaufmann [2] “Sugiyama Algorithm” Nikolov [3] “Graph Drawing Algorithms in Information Visualization” Frishman
Methods
__init__
([edges, vertical_distance, ...])get_layer
(vertex)The layer id of the node
get_position
(vertex)The position of the node
set_size
(vertex, width, height)Set the size of the node
Coordinate Assignment
- __init__(edges=[], vertical_distance=10.0, horizontal_distance=10.0)
- class Node(id)
Bases:
object
Temporary node that caches all the intermediate compute data
- add_upstream(node)
Add the upstream node. It will add current node to downstream as well.
- get_layer(vertex)
The layer id of the node
- get_position(vertex)
The position of the node
- set_size(vertex, width, height)
Set the size of the node
- update_positions()
Coordinate Assignment