Graph::Easy - Manual

Layouter

If you haven't done so, please read the Overview first, followed by the chapter about the Layouter details.

Graph::Easy's layouter is responsible for converting a (internal) graph representation into a specific layout. Here are two example layouts, automatically produced from the same input graph:

Example layout of simple graph
+---+     +---+     +---+
| A | --> | C | --> | D |
+---+     +---+     +---+
            |
            |
            v
          +---+
          | E |
          +---+

Influencing the Layout

Although the placement of nodes, edges and labels is completely automated, you can influence the created layout by giving the layouter hints like the following:

Some of the hints will be used only as hints by the layouter, e.g. it might ignore them to produce a complete layout. Other hints like relative node placements are taken as strict "must do", and these might create dilemmas for the layouter. So use them only when absolutely neccessary.

Flow Direction

While East is the prefered direction for all edges, you can use the attribute flow to let the graph flow in another general direction.

graph { flow: south; }

[ Hamm ] -> [ Essen ] -> [ Olpe ]
+-------+
| Hamm  |
+-------+
  |
  |
  v
+-------+
| Essen |
+-------+
  |
  |
  v
+-------+
| Olpe  |
+-------+
graph { flow: left; }

[ Hamm ] -> [ Essen ] -> [ Olpe ]
+------+     +-------+     +------+
| Olpe | <-- | Essen | <-- | Hamm |
+------+     +-------+     +------+

All four flow directions (north, south, west, east) are supported, even when generating graphviz code (dot does not easily support upwards and leftwards flow directions without some trickery).

You can also change the flow on a per-node basis:

graph { flow: left; }

[ Duisburg ] -> [ Siegen ] { flow: south; }
 -> [ Adenau ]
+--------+     +----------+
| Siegen | <-- | Duisburg |
+--------+     +----------+
  |
  |
  v
+--------+
| Adenau |
+--------+

Node sizes

With the attributes size, columns and rows you can influence the size of a node in cells.
Please see the chapter about Advanced Syntax for details and examples.

Groups

You can group nodes together by using braces:

( German Cities
  [ Berlin ] -> [ Potsdam ]
) {
  background: lightbrown;
  }

Putting nodes into a group gives the layouter the hint that these nodes are related and should be laid out closely together.
Please see the chapter about Advanced Syntax for details and examples.

Relative Node Placement

You can place each node relatively to another node. Please see the chapter about Advanced Syntax for details and examples.