Graph Rule Definition

In this section, you will learn about defining graph rules inside an xml configuration file. Such a file is included with this tutorial and is aptly called “rules.xml”.

Below is a sample GraphRule defined in an attribute-based xml format. This type of rule is applied to a visual graph as a whole and is much simpler than the rules created for its embedded visual elements.

Example 6.1. Graph Rule XML Fragment

...

<list name="Rule">
 <attribute name="Name" type="String" value="graphrule"/>
 <attribute name="Type" type="String" value="GraphRule"/>
 <list name="Properties">
  <attribute name="EdgeInsertSinglePosition" type="Boolean" value="false"/>
  <attribute name="AutoSpaceMode" type="String" value="no autospace"/>
  <attribute name="AcceptLooseObjects" type="Boolean" value="true"/>
 </list>
</list>
 
...

There are various visual graph attributes which together form the basis of a rule. For visual graph objects, the relevant attributes are listed below.