Examples

Four examples are provided in the GraphSynth download, and more will be available soon for more complicated (albeit mechanical engineering) applications.

### Swirl

Files:     input/swirlSeed1.xml
rules/swirlRuleSet.xml
rules/swirlRule1.xml
rules/swirlVertices.cs
output/candidate00#.xml
Swirl is a simple 1 rule system. That makes counter-clockwise patterns from either end of a simple seed. The magic of this is found primarily in the parametric rule application that updates the position of vertices (not nodes! this is also an example of how inherited classes can be used) by increasing the edge slope and the edge length.

### Loop

Files:     input/loopSeed1.xml
rules/loopExampleRuleSet.xml
rules/loopRule1.xml
output/looped.xml
Loop is also a 1 rule system. The rule expands an existing loop and wreaks havoc on the direction of the arcs. This example is mainly to show the use of embedding rules. Note that this works despite the lack of commonality between the left and right hand sides of the rule.

### SeedBurst

Files:     input/seedBurst1.xml
rules/seedBurst5rule1.xml
rules/seedBurst3rule2.xml
rules/seedBurst2rule3.xml
rules/seedBurst1rule4.xml
rules/seedBurstRuleSet.xml
output/29burst.xml
output/35burst.xml

SeedBurst is an interesting an example of both parametric recognize and choose functions. Given a seed that is a single node, the four rules of SeedBurst create a unique tree for the integer where each leaf of the tree is represented with a value of “1”. One additional thing to notice about this system, is that the rule set is Automatic and not Design (see description on rule set page).

### Route

Files:     input/citiesDefaultSeedGraph.xml
input/MajorUSAcities.xml
rules/Routerule1.xml
rules/Routerule2.xml
rules/Routerule3.xml
rules/RouteGetToSpanningRuleSet.xml
rules/RouteGetToCompleteRuleSet.xml
output/MST5cities.xml

Route is an example of how more than one rule set can work together to create a candidate solution. Here, the first rule set transitions the graph from just a list of unconnected nodes to a spanning tree (the minimum spanning tree is easily identified with Prim’s or Kruskal’s algorithm which could be implemented in an intelligent choosing function—that minimum spanning tree is shown in the output directory). Afterwards, we would like to add additional routes between cities for convenience in traveling from any location to any other location. The two rule sets will create a random candidate—”you’re free to move about the country”.