next up previous contents index
Next: Control Flow Graph Up: GDL Examples Previous: GDL Examples

A Cyclic Graph

These examples show a number of small cyclic graphs without any labels but with different edge types. The titles are displayed in the nodes. The last example in this sequence shows how the anchor edge attribute is used.

Example 1: Ordinary Edges

aiSee tries to give all edges the same orientation. But since the graph is cyclic, one edge has to be reverted (edge "D"->"A").

graph: {

node: {title:"A"}
node: {title:"B"}
node: {title:"C"}
node: {title:"D"}
node: {title:"E"}

edge: {source:"A" target:"B"}   // 1
edge: {source:"A" target:"C"}   // 2
edge: {source:"C" target:"D"}   // 3
edge: {source:"D" target:"E"}   // 4
edge: {source:"D" target:"A"}

}

Example 2: Back Edge

The edge to be reverted can be specified as a back edge.

backedge: {source:"C" target:"D"}   // 3

Example 3: Near Edges

Near edges can be used to express a close relationship between two nodes and to place nodes right- or left-neighbored.

nearedge: {source:"A" target:"B"}   // 1
nearedge: {source:"A" target:"C"}   // 2
nearedge: {source:"D" target:"E"}   // 4

Example 4: Bent Near Edges

In some situations, edges are to be horizontally anchored, like near edges, yet the target node is not to be at the same level. These edges have to have a bend point. This is why bent near edges are used.

bentnearedge: {source:"A" target:"B"}   // 1
bentnearedge: {source:"D" target:"E"}   // 4

Example 5: Right (Bent) Near Edges

The left or right versions of bent near edges or near edges can be used if it is important to have edges anchored to a particular side of a node.

rightbentnearedge: {source:"A" target:"B"}   // 1
     leftnearedge: {source:"A" target:"C"}   // 2
rightbentnearedge: {source:"D" target:"E"}   // 4

Example 6: Edge Anchors

The anchor edge attribute can be used if a node label consists of one or more fields that are on separate lines where outgoing edges are to start. For example, if node "D" represents a struct with two fields whose first field is to point to node "E" and the second one to node "A", then the edges are anchored to the corresponding anchor points 1 and 2. Counting of anchor points starts with 1 at the top of a node and increases from top to bottom.

Anchor points and near edge specifications cannot be used together, consequently the specification for Example 6 looks like this:

graph: {

node: {title:"A"}
node: {title:"B"}
node: {title:"C"}
node: {title:"D" label:"Field1\nField2"}
node: {title:"E"}

bentnearedge: {source:"A" target:"B"}
    nearedge: {source:"A" target:"C"}
    backedge: {source:"C" target:"D"}
        edge: {source:"D" target:"E" anchor:1}
        edge: {source:"D" target:"A" anchor:2}

}


next up previous contents index

Last modified on 1 December 2001 by webmaster. © 2000-2001 AbsInt