GraphViz2::Abstract::Edge - Deal with edges independent of a Graph
version 0.002000
use GraphViz2::Abstract::Edge; my $edge = GraphViz2::Abstract::Edge->new( color => ... , id => ... , label => ... , ); # Mutate $edge $edge->label("Asdft"); my $fillcolor = $edge->fillcolor(); # Knows that the fill color is light grey despite never setting it. # Later: $graph->add_edge(from => a => to => b => %{ $edge->as_hash }); # Adds only the data that is not the same as GraphViz's defaults $graph->add_edge(from => a => to => b => %{ $edge->as_canon_hash }); # Adds all the data, including hardcoded defaults
Working with GraphViz2, I found myself frequently needing shared styles for things, and I often had trouble knowing which fields were and weren't valid for given things, for instance: Edges.
Edge
Its reasonably straight forward to ask the question "What is the attribute foo applicable to" using the GraphViz website, but much harder to know "What are all the attributes applicable to foo".
foo
Let alone work with them in a user friendly way from code.
I tried to choose a name that was not so likely to threaten GraphViz2 if GraphViz2 wanted to make a different variation of what I'm doing, but as part of GraphViz2 itself.
As such, I plan on a few ::Abstract things, that aim to be stepping stones for dealing with complex data independent of GraphViz2, but in such a way that they make importing that data into GraphViz2 easy.
::Abstract
GraphViz2
as_hash
This method returns all the values of all properties that DIFFER from the defaults.
e.g.
Edge->new( color => 'black' )->as_hash();
Will return an empty list, as the default color is normally black.
See also how special constants work in
as_canon_hash
This method returns all the values of all properties, INCLUDING defaults.
Edge->new( color => 'black' )->as_canon_hash();
Will return a very large list containing all the properties that we know the default values for.
URL
Default: none
none
arrowhead
Default: 'normal'
'normal'
arrowsize
Default: 0.0
0.0
arrowtail
color
Default: 'black'
'black'
colorscheme
Default: ""
""
comment
constraint
Default: true
true
decorate
Default: false
false
dir
Default: unknown
unknown
edgeURL
edgehref
edgetarget
edgetooltip
fillcolor
fontcolor
fontname
Default: 'Times-Roman'
'Times-Roman'
fontsize
Default: 14.0
14.0
headURL
head_lp
headclip
headhref
headlabel
headport
Default: 'center'
'center'
headtarget
headtooltip
href
id
label
labelURL
labelangle
Default: -25.0
-25.0
labeldistance
Default: 1.0
1.0
labelfloat
labelfontcolor
labelfontname
labelfontsize
labelhref
labeltarget
labeltooltip
layer
len
Reason: back-end dependent
lhead
lp
ltail
minlen
Default: 1
1
nojustify
penwidth
pos
samehead
sametail
showboxes
Default: 0
style
tailURL
tail_lp
tailclip
tailhref
taillabel
tailport
tailtarget
tailtooltip
target
tooltip
weight
xlabel
xlp
Kent Fredric <kentfredric@gmail.com>
This software is copyright (c) 2013 by Kent Fredric <kentfredric@gmail.com>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install GraphViz2::Abstract::Edge, copy and paste the appropriate command in to your terminal.
cpanm
cpanm GraphViz2::Abstract::Edge
CPAN shell
perl -MCPAN -e shell install GraphViz2::Abstract::Edge
For more information on module installation, please visit the detailed CPAN module installation guide.