hwtGraph.elk.containers package

Submodules

hwtGraph.elk.containers.constants module

class hwtGraph.elk.containers.constants.EdgeConstraint(value)

Bases: Enum

Enumeration of edge constraints. Edge constraints can be set on ports to constrain the type of edges incident to that port.

See:

EdgeAndLayerConstraintEdgeReverser

INCOMING_ONLY = 1
NONE = 0
OUTGOING_ONLY = 2
class hwtGraph.elk.containers.constants.EdgeRouting(value)

Bases: Enum

An enumeration.

ORTHOGONAL = 2
POLYLINE = 1
SPLINES = 4
UNDEFINED = 0
class hwtGraph.elk.containers.constants.EdgeStraighteningStrategy(value)

Bases: Enum

Specifies how the compaction step of the {@link BKNodePlacer} should be executed.

IMPROVE_STRAIGHTNESS = 1
NONE = 0
class hwtGraph.elk.containers.constants.FixedAlignment(value)

Bases: Enum

Layout option for the choice of candidates in the Brandes & Köpf node placement.

BALANCED = 5
LEFTDOWN = 3
LEFTUP = 1
NONE = 0
RIGHTDOWN = 4
RIGHTUP = 2
class hwtGraph.elk.containers.constants.HierarchyHandling(value)

Bases: Enum

Options for setting how children of nodes should be handled in the current layout run. There are three options for this:

Variables:
  • ~.INHERIT – The current node should implement the same behavior as the parent node. If the root node is evaluated and it is set to inherit (or not set at all) the property is set to {@link #SEPARATE_CHILDREN}.

  • ~.INCLUDE_CHILDREN – The children of the current node should be included in the current layout run. This enables edges to be routed across the boundary of hierarchy layers.

  • ~.SEPARATE_CHILDREN – The children of the current node are layouted independently from their parent node. The resulting layout information is then used to layout the parent node.

The inclusion of further children can be disabled by setting the option back to SEPARATE_CHILDREN at lower levels. For this option to have any effect, the option needs to be set to at least two successive levels of hierarchy.

If the layout algorithm doesn’t support hierarchical layout, this property is ignored and the layout is calculated separately for each child hierarchy.

Note:

Layout algorithms only need to differentiate between INCLUDE_CHILDREN and SEPARATE_CHILDREN as the inheritance is evaluated by ELK.

INCLUDE_CHILDREN = 1
INHERIT = 0
SEPARATE_CHILDREN = 2
class hwtGraph.elk.containers.constants.InLayerConstraint(value)

Bases: Enum

Enumeration of in-layer constraint types. In-layer constraints divide a layer into three parts: the normal part, a top part and a bottom part. This constraint can be set on nodes to define in which part they may appear.

See:

InLayerConstraintProcessor

BOTTOM = 2
NONE = 0
TOP = 1
class hwtGraph.elk.containers.constants.LayerConstraint(value)

Bases: Enum

Enumeration of layer constraint types. May be set on nodes to constrain in which layer they may appear.

:see EdgeAndLayerConstraintEdgeReverser :see LayerConstraintProcessor

FIRST = 1
FIRST_SEPARATE = 2
LAST = 3
LAST_SEPARATE = 4
NONE = 0
class hwtGraph.elk.containers.constants.LayeredOptions

Bases: object

SPACING_EDGE_EDGE = 10
SPACING_EDGE_EDGE_BETWEEN_LAYERS = 10
SPACING_EDGE_NODE = 10
SPACING_EDGE_NODE_BETWEEN_LAYERS = 10
SPACING_LABEL_NODE = 5
SPACING_LABEL_PORT = 1
SPACING_NODE_NODE = 20
SPACING_NODE_NODE_BETWEEN_LAYERS = 20
SPACING_PORT_PORT = 10
class hwtGraph.elk.containers.constants.NodeType(value)

Bases: Enum

An enumeration.

BIG_NODE = 5
BREAKING_POINT = 6
EXTERNAL_PORT = 2
LABEL = 4
LONG_EDGE = 1
NORMAL = 0
NORTH_SOUTH_PORT = 3
class hwtGraph.elk.containers.constants.PortConstraints(value)

Bases: Enum

An enumeration.

FIXED_ORDER = 3
FIXED_POS = 5
FIXED_RATIO = 4
FIXED_SIDE = 2
FREE = 1
UNDEFINED = 0
isOrderFixed()

Returns whether the order of ports is fixed.

@return true if the order of ports is fixed

isPosFixed()

Returns whether the position of the ports is fixed. Note that this is not true if port ratios are fixed.

@return true if the position is fixed

isRatioFixed()

Returns whether the ratio of port positions is fixed. Note that this is not true if the port positions are fixed.

@return true if the ratio is fixed

isSideFixed()

Returns whether the sides of ports are fixed.

@see PortSide @return true if the port sides are fixed

class hwtGraph.elk.containers.constants.PortSide(value)

Bases: Enum

An enumeration.

EAST = 0
NORTH = 3
SOUTH = 2
WEST = 1
static opposite(side)
class hwtGraph.elk.containers.constants.PortType(value)

Bases: Enum

An enumeration.

INPUT = 1
OUTPUT = 2
UNDEFINED = 0
classmethod opposite(t)
exception hwtGraph.elk.containers.constants.UnsupportedConfigurationException

Bases: Exception

hwtGraph.elk.containers.idStore module

class hwtGraph.elk.containers.idStore.ElkIdStore(*args, **kwargs)

Bases: dict

Attention:

First register nodes then register ports otherwise id will not be generated correctly

getMaxId()
register(obj)
registerEdge(edge: LEdge)
registerNode(node: LNode)
registerPort(port: LPort)

hwtGraph.elk.containers.lEdge module

class hwtGraph.elk.containers.lEdge.LEdge(parentNode: LNode, srcs: List[LPort], dsts: List[LPort], name: str = None, originObj=None)

Bases: object

Edge in layout graph

Variables:
  • ~.parentNode – parent node instance

  • ~.name – name of this edge (label)

  • ~.originObj – optional object which was this edge generated for

  • ~.srcs – list of LPort instances where this edge starts

  • ~.dsts – list of LPort instances where this edge ends

addSource(src: LPort, addToSrc=True)
addTarget(dst: LPort, addToDst=True)
remove()
removeSource(src: LPort)
removeTarget(dst: LPort)
toElkJson(idStore, path_prefix: ComponentPath)

hwtGraph.elk.containers.lNode module

class hwtGraph.elk.containers.lNode.LNode(parent: LNode | None = None, name: str | None = None, cls: str | None = None, originObj=None, node2lnode=None, bodyText=None)

Bases: object

Component for component diagram

Variables:
  • ~.originObj – original object which this node represents

  • ~.name – name of this unit

  • ~.class_name – name of class of this unit

  • ~.north – list of LPort for on top side.

  • ~.east – list of LPort for on right side.

  • ~.south – list of LPort for on bottom side.

  • ~.west – list of LPort for on left side.

  • ~.bodyText – text which should be rendered inside body of component (if it is not only container of children)

  • ~._shared_component_with – optional LNode insance if set the body of this component is not filled and it is same as the _shared_component_with LNode

addEdge(src: LPort, dst: LPort, name=None, originObj=None)
addHyperEdge(srcs, dsts, name=None, originObj=None)
addNode(name: str | None = None, cls: str | None = None, originObj=None, portConstraint=PortConstraints.FIXED_ORDER, bodyText=None) LNode
addPort(name, direction: PortType, side: PortSide, originObj=None)
getNode()
getPortSideView(side) List[LPort]

Returns a sublist view for all ports of given side.

Attention:

Use this only after port sides are fixed!

This is currently the case after running the {@link org.eclipse.elk.alg.layered.intermediate.PortListSorter}. Non-structural changes to this list are reflected in the original list. A structural modification is any operation that adds or deletes one or more elements; merely setting the value of an element is not a structural modification. Sublist indices can be cached using {@link LNode#cachePortSides()}.

Parameters:

side – a port side

Returns:

an iterable for the ports of given side

iterEdges(filterSelfLoops=False)

Iter edges connected from outside of this unit

iterPorts() Generator[LPort, None, None]
iterPortsWithReverseFlag() Generator[LPort, None, None]
toElkJson(idStore: ElkIdStore, path_prefix: ~hwt.synthesizer.componentPath.ComponentPath = <ComponentPath >, isTop=True)
toElkJson_registerNodes(idStore, path_prefix: ComponentPath)
toElkJson_registerPorts(idStore, path_prefix: ComponentPath)

The index of a port in the fixed order around a node. The order is assumed as clockwise, starting with the leftmost port on the top side. This option must be set if ‘Port Constraints’ is set to FIXED_ORDER and no specific positions are given for the ports. Additionally, the option ‘Port Side’ must be defined in this case.

class hwtGraph.elk.containers.lNode.LayoutExternalPort(parent: LNode, name: str | None = None, direction=None, node2lnode=None, originObj=None)

Bases: LNode

toElkJson(idStore, isTop=True, path_prefix=None)

hwtGraph.elk.containers.lPort module

class hwtGraph.elk.containers.lPort.LPort(parent: LNode, direction: PortType, side: PortSide, name: str = None, originObj=None)

Bases: object

Port for component in component diagram

Variables:
  • ~.originObj – original object which this node represents

  • ~.parent – parent unit of this port

  • ~.name – name of this port

  • ~.direction – direction of this port

  • ~.geometry – absolute geometry in layout

  • ~.children – list of children ports, before interface connecting phase (when routing this list is empty and children are directly on parent LNode)

  • ~.connectedAsParent – it True the port does not contain any explicit connections but is connected as a parent port

  • ~.index – The index of a port in the fixed order around a node. The order is assumed as clockwise, starting with the leftmost port on the top side. This option must be set if ‘Port Constraints’ is set to FIXED_ORDER and no specific positions are given for the ports. Additionally, the option ‘Port Side’ must be defined in this case.

getLevel()

Get nest-level of this port

iterEdges(filterSelfLoops=False)
toElkJson(idStore, path_prefix: ComponentPath)