Wgraph:Tutorial types

From FollowTheScore
Jump to: navigation, search

node and edge types

  • a node or edge can be assigned to one or more type(s) via the 'type' property
  • there is a base nodetype called '*'; every node belongs to that type; therefore nodetype '*' can be used to set defaults.
  • there is a base edgetype called '*'; every edge belongs to that type; therefore edgetype '*' can be used to set defaults.
  • multiple assignments cumulate; the type statement expects a comma separated list of types
    • node x { type a type b } is equivalent to node x { type a,b } or node x { type 'a,b' }
    • undefined nodes (i.e. nodes, which are mentioned in an edge definition but are never explicitly defined) are automatically assigned to the type "undefined node".
    • You may set properties like color or bordercolor for that nodetype. But there is no pre-defined setting for this nodetype.
  • properties of types are transferred ("applied") to nodes/edges which belong to that type.
  • The sequence in which properties are assigned is defined by the sequence in which the nodetype (or edgetype) statements occur within the WGL code.
  • This sequence can be overwritten by the 'nodetypes' or 'edgetypes' statement, which allow to define individual order sequences.
  • normally only properties are overwritten, which are not already defined (on node/edge level or via previous type-based property assignments).
  • The only exception is the 'label' property. If a type defines a label property, the label text will be transferred to all nodes of that type. The special character sequence '%%' can be used to depict the current contents of the label. So nodetype x { label '%%?' } will put a questionmark behind the label of each node which belongs to type 'x'.