Package mapss.dif.graph.hierarchy

Provides classes to implement hierarchical/clustered graphs.

See:
          Description

Class Summary
Hierarchy Hierarchy class is a wrapper around a mocgraph.Graph object for implementing hierarchical features.
Port Port class for interfacing of hierarchy objects with other hierarchies.
PortList List of ports in a hierarchy.
SuperNodeMap List of super nodes in a hierarchy.
 

Exception Summary
CyclicHierarchyException This exception is thrown when a cycle in the hierarchy of graphs is detected.
HierarchyException This exception can be thrown by the methods in Hierarchy class.
 

Package mapss.dif.graph.hierarchy Description

Provides classes to implement hierarchical/clustered graphs.

The purpose of the Hierarchy package is to form a wrapper around Graph objects to implement hierarchical graphs. Using this package, sub-graphs can be defined within graphs, nodes of a sub-graph can be connected to its super-graph via ports and super-nodes (nodes that contain sub-graphs in them) can be flattened to merge different levels. Throughout the Hierarchy package documentation the words parent/super and child/sub are used interchangeably. Also hierarchy enabled graphs are called hierarchies in short.

Defining a hierarchy enabled graph requires two steps:

Ports are connected to either nodes or ports of sub-graphs inside a graph. This is called "relating" a port with a node or another port.

Once graphs are hierarchy enabled they can be cascaded. Following are the steps to add a sub-graph to a graph:

To replace a super node with its associated graph Hierarchy.flatten() method is provided. This method places a mirror (see synthesis.dif.DIFMirrorTransformation) of the graph object into the parent graph and removes the super node. Inner and outer port connections are merged as well.

Following figure shows a hierarchy structure that contains the elements mentioned before.

Users should pay special attention while modifying a graph (by using add-remove methods) after creating a hierarchy object which uses that graph. This is because Hierarchy class doesn't reinforce consistency between the graph elements and the hierarchy envelope. Super nodes, port nodes and connection edges are not checked for presence in the graph until flatten function is called on a super node. HierarchyException class provides static functions to manually perform these checks. Hierarchy.purge() functions are another way to filter out such bad associations in a Hierarchy object.