Graphs |
Graphs are stored in GraphSynth as designGraph.cs. public partial class designGraph { #region Fields public string name; public List<string> globalLabels = new List<string>(); public List<double> globalVariables = new List<double>(); public List<node> nodes = new List<node>(); public List<arc> arcs = new List<arc>(); #endregion The graph contains a name, labels (which are any number of strings), and variables (a list of any number of double-real's). Additionally, there are two lists: one for arcs and one for nodes. This is a “partial” description of the designGraph class, the rest is stored in the XMLandIO directory. The classes for arc and node are also fairly straightforward. Note that each of these contains references to the connecting elements (to and from in arc point to the two nodes connected to the arc; and arcsTo, arcsFrom, and arcs in node reference connecting arcs). One can freely draw graphs in GraphSynth by clicking File→New→Graph or typing Ctrl+N. A small empty box appears for you to add nodes, arcs and their labels. There are five node shapes. These can be added by right-clicking and scrolling to “Basic Shapes” or by typing Ctrl+1, Ctrl+2, Ctrl+3, Ctrl+4, or Ctrl+5. Each of these shapes has one or more connection points. By hovering the mouse over a connection point, one and click-and-drag arcs between shapes. By double-clicking an arc or node, or clicking Properties from the right-click menu, one can access various properties of the element. |
Graphs like all other GraphSynth elements are stored as XML files. These files can be opened in a text editor and altered as well. The example graph in figure one is saved as the following: |
Figure 1: Creating a new graph in GraphSynth is accomplished by adding new nodes (with right-click or Ctrl+#), dragging arcs into places, and adjusting properties via the Properties Window. |
Inherited TypesInherited types can be created for nodes and arcs so that applications requiring more descriptive objects for nodes and arcs can be used. Note that in the XML, the second node is qualified by the vertex type. As an example of inherited classes, a basic implementation of vertex and edge are presented in the file, inheritedGeometryClasses.cs. Once these are created and properly compiled in GraphSynth, the classes can be placed in the Properties Window under the nodeType or arcType tags. Additionally, the types can be used in the creation of rules. If a rule is made for vertices and edges it will only be recognized on graphs that contain such classes. |