The NETDRAW Procedure

Organizational Charts or Tree Diagrams

The NETDRAW procedure automatically draws any acyclic network; it does not have to be a representation of a project. You can also use the procedure to draw a general directed graph that has cycles, if node location is specified or if the BREAKCYCLE option is specified. The procedure attempts to draw the network in a compact fashion, which may not always produce the expected result. Trees form one such class of directed graphs that have an inherent natural layout that may not be produced by the default layout of PROC NETDRAW. The TREE option in the ACTNET statement exploits the tree structure of the network by laying the nodes out in the form of a tree.

A directed graph is said to be a tree if it has a root and there is a unique directed path from the root to every node in the tree. An equivalent characterization of a tree is that the root node has no predecessors and every other node has exactly one predecessor (Even 1979). Typical examples of trees that arise in project management are organizational charts or work breakdown structures. If the TREE option is specified, the NETDRAW procedure checks if the network has a tree structure and draws the network with the root at the left edge of the diagram and the children of each node appearing to the right of the node. In other words, the tree is drawn from left to right.

The NETDRAW procedure enables you to specify multiple trees in the same Network data set; each tree is drawn separately in the same diagram with all the roots appearing at the left edge of the diagram. Thus, you can use the TREE option as long as every node in the network has at most one predecessor. It you specify the TREE option and some node has multiple predecessors, the TREE option is ignored and the procedure uses the default node-layout algorithm.

There are several features that control the appearance of the tree:

  • The children of each node are placed in the order of occurrence in the Network data set. The $(x,y)$ coordinates of each node are required to be integers. The procedure attempts to place each node at the center of all its children, subject to the requirement that the coordinates must be integers. This requirement may cause some of the nodes to be positioned slightly off-center. See Example 9.15.

  • The SEPARATESONS option separates the children of a node, if necessary, to enable the parent node to be exactly centered with respect to its children. See the second part of Example 9.15.

  • The CENTERSUBTREE option can be used to center each node with respect to the entire subtree originating from the node instead of centering it with respect to its children.

  • In graphics mode, you can change the orientation of the network to be from top to bottom instead of from left to right. To do so, use the ROTATETEXT option in the ACTNET statement to rotate the text within the nodes and the ROTATE option in the ACTNET statement (or the ROTATE global graphics option) to rotate the entire diagram by 90 degrees. See Example 9.18 for an illustration of this feature.