Wgraph:Tutorial identifiers

From FollowTheScore
Jump to: navigation, search

Uniqueness of Identifiers

  • Nodes are identified by unique literal node-identifiers
  • Edges are internally identified by a sequential number.
  • If a node is defined more than once, the last definition overwrites earlier definitions of the same property. Other property settings from earlier definitions are NOT deleted, however (watch what happens to node 'A').
  • If you have two or more edges between the same nodes you will see them both (all) in the graph.

Underscores and Spaces in Identifiers

  • If node-identifiers contain spaces, they must be quoted.
  • As an alternative you can use underscores (which are always converted to spaces internally).

Identifiers and Labels

  • When displaying a node, the 'label' property will be shown, not the identifier.
    • If no label was specified, the identifier will be used as default label.
    • Label = "" will reset the label to nullstring, i.e. no text will be shown at all.
  • Edges are identified by a pair of node-identifiers (source node & target node)
  • Edges are always directed from the source to the target
  • note that edge "a" "b" {} will NOT work because "a" "b" will be concatenated to ONE string yielding "ab". You must use the keyword 'to' in such cases; edge "a a" to "b b" {} or edge from "a a" to "b b" {} will work; edge a_a b_b {} is also o.k. You could even write edge "a a" 'b b' {}.
  • you can use arrow properties to show or suppress arrow symbols; arrows may either point from source to target or in the opposite direction ('backarrow')
  • Edges can carry labels but they do not do so by default.


Wgraph:Sample 2.wgl graph
node A           { color yellow 
                   bordercolor green 
                   borderwidth 5
                 }
node node_B      { }
node C           { label "and that is node C" }
node "D dummy"   { label "" shape circle 
                   color red bordercolor red }
edge A node_B    { label 1 }
edge A node_B    { label 2 }
edge node_B A    { label 3 }
edge 'node B' C  { }
edge C "D dummy" { label "a link to nowhere" }
node A           { color magenta  width 120 }


png | svg | thumb=30 | node A { color yellow
                   bordercolor green 
                   borderwidth 5
                 }
node node_B      { }
node C           { label "and that is node C" }
node "D dummy"   { label "" shape circle 
                   color red bordercolor red }
edge A node_B    { label 1 }
edge A node_B    { label 2 }
edge node_B A    { label 3 }
edge 'node B' C  { }
edge C "D dummy" { label "a link to nowhere" }
node A           { color magenta  width 120 }
}}