Size: 777
Comment:
|
Size: 7949
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 6: | Line 6: |
http://www.tonyballantyne.com/graphs.html == Slackware64 14.1 install == * cd /tmp * wget http://slackbuilds.org/slackbuilds/13.0/graphics/graphviz.tar.gz * tar xvzf graphviz.tar.gz * cd graphviz * wget http://graphviz.org/pub/graphviz/stable/SOURCES/graphviz-2.26.3.tar.gz * |
|
Line 9: | Line 19: |
* cd /tmp * wget http://moinmo.in/GraphVizForMoin?action=AttachFile&do=view&target=MoinGraphViz-1.0rc4-brn-1.9.x.comp.zip * unzip MoinGraphViz-1.0rc4-brn-1.9.x.comp.zip * cd/tmp/MoinGraphViz-1.0rc4-brn-1.9.x.comp/wiki/data/plugin * cp * -r /home/moin/moin-1.9.7/wiki/data/plugin/ * cd /home/moin/moin-1.9.7/wiki/data/plugin/ * chown moin * -R * chgrp apache * -R * cd/tmp/MoinGraphViz-1.0rc4-brn-1.9.x.comp/umoin * cp MoinLegacy /home/moin/moin-1.9.7/MoinMoin/support/ * cd /home/moin/moin-1.9.7/MoinMoin/support/ * chown moin * -R * chgrp apache * -R * yum install graphviz * vim /home/moin/moin-1.9.7/wiki/data/plugin/parser/MoinGraphViz/main-py # GRAPHVIZ_TOOLS_DIR = r'/usr/bin' * service httpd restart == Windows configuration == On file <...>moin-1.9.7\wiki\data\plugin\parser\MoinGraphViz\main.py change in line 254 from close_fds=True to close_ds=False, due to error launched in Windows. {{{#!highlight python def oscmd(cmd): '''instead of simply calling os.system(cmd) capture stderr and raise GraphvizRenderError if exit code != 0 ''' p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True, bufsize=1024, close_fds=False) stdo, stde = p.communicate() if p.returncode != 0: raise GraphvizRenderError("%s\n%s" % (stdo, stde)) }}} === Test after installation === If all was installed correctly a graph should appear below {{{#!GraphViz dot digraph SomeGraph { A -> { B C } B -> C } }}} |
|
Line 10: | Line 63: |
{{{ | {{{#!GraphViz dot |
Line 24: | Line 77: |
=== UML Sample 1 === |
|
Line 25: | Line 80: |
{{{#!GraphViz dot digraph UMLTest { fontname = "Bitstream Vera Sans" fontsize = 8 node [ fontname = "Bitstream Vera Sans" fontsize = 8 shape = "record" ] edge [ fontname = "Bitstream Vera Sans" fontsize = 8 ] Animal [ label = "{Animal|+ name : string\l+ age : int\l|+ die() : void\l}" ] subgraph clusterAnimalImpl { label = "Package animal.impl" Dog [ label = "{Dog||+ bark() : void\l}" ] Cat [ label = "{Cat||+ meow() : void\l}" ] } edge [ arrowhead = "empty" ] Dog -> Animal Cat -> Animal edge [ arrowhead = "none" headlabel = "0..*" taillabel = "0..*" ] Dog -> Cat } }}} === UML Sample 2 === http://www.lornajane.net/posts/2011/uml-diagrams-with-graphviz {{{#!GraphViz dot digraph Couriers { fontname = "Bitstream Vera Sans" fontsize = 8 node [ fontname = "Bitstream Vera Sans" fontsize = 8 shape = "record" ] edge [ arrowtail = "empty" ] Courier [ label = "{Courier|+ name : string\l+ home_country : string\l|+ calculateShipping() : float\l+ ship(): boolean\l}" ] Monotype [ label = "{MonotypeDelivery|\l|+ ship(): boolean\l}" ] Pigeon [ label = "{PigeonPost|\l|+ ship(): boolean\l}" ] Courier -> Pigeon [dir=back] Courier -> Monotype [dir=back] } }}} === UML Sample 3 === http://canvoki.net/coder/resources/DotUmlUseCases.html http://canvoki.net/coder/DotUseCases/MarUseCases.dot {{{#!GraphViz dot digraph example { rankdir=LR; bgcolor="#eeeeff"; node [fontname=Arial, fontsize=10]; edge [color=red, style=bold, fontsize=9]; // Actors { node [shape=custom, shapefile="Actor.png", width=.352, height=0.77, fixedsize=true, color="#ffffaa", label="\n\n\n\n\n\n\N"] Shark Submariner Pirate Merchant } // System Use Cases subgraph clusterSystem { label="Sea"; // Name your system here fillcolor="#ffffdd"; style=filled; color=black; // The system box node [shape=ellipse, style=filled, fillcolor="#ccffcc", color="#558855"] Batism Inmersion "Eat pirates" // You can name it with spaces // But is better to use a 'label' property to make easier the references Tresour [label="Find a tresour"] Attack [label="Attack ships"] Escafandrarse [label="Put on the\nescafandre"] // Multiline Ron [label="Drink Ron"] SellGoods Navigate GaleonPiloting [label="Navigate in galeon"] BuyGoods [label="Buy Goods"] } // Uses Submariner -> Inmersion Submariner -> Batism Pirate -> Attack Pirate -> Ron Merchant -> SellGoods Shark -> "Eat pirates" // Extensions { edge [label="<<extends>>", dir=back] Inmersion -> Tresour } // Inclusions { edge [label="<<includes>>"] Inmersion -> Escafandrarse SellGoods -> Navigate SellGoods -> BuyGoods Attack -> GaleonPiloting } // Generalizations { edge [arrowsize=1.5, arrowtail=empty, dir=back, constraint=false] Inmersion -> Batism Navigate -> GaleonPiloting } } }}} === UML Sample 4 === http://fsteeg.wordpress.com/2006/11/16/uml-activity-diagrams-with-graphviz/ {{{#!GraphViz dot digraph untitled { rankdir=TD size="4,4" edge[fontsize="11" arrowhead=open] start[shape=circle, label="", style=filled] end[shape=doublecircle, label="", style=filled] action1[shape=box,style=rounded, label="action"] action2[shape=box,style=rounded, label="action"] action3[shape=box,style=rounded, label="action"] if1[shape=diamond, label="decision"] if2[shape=diamond, label="decision"] start -> action1 action1 -> if1[headport=n] if1 -> action2[label="condition" tailport=w] if1 -> action3[taillabel="condition" labeldistance=2.5 tailport=e] action2 -> if2[headport=w] action3 -> if2[headport=e] if2 -> end[taillabel="condition"] } }}} {{{ digraph untitled { rankdir=TD size="4,4" edge[fontsize="11" arrowhead=open] start[shape=circle, label="", style=filled] end[shape=doublecircle, label="", style=filled] action1[shape=box,style=rounded, label="action"] action2[shape=box,style=rounded, label="action"] action3[shape=box,style=rounded, label="action"] if1[shape=diamond, label="decision"] if2[shape=diamond, label="decision"] start -> action1 action1 -> if1[headport=n] if1 -> action2[label="condition" tailport=w] if1 -> action3[taillabel="condition" labeldistance=2.5 tailport=e] action2 -> if2[headport=w] action3 -> if2[headport=e] if2 -> end[taillabel="condition"] } }}} {{{#!GraphViz dot digraph untitled { rankdir=TD ClassA[shape=rectangle] ClassB[shape=rectangle] { edge[label=" 1.method1() \l 2. method2()"] ClassA->ClassB} { edge[label=" 4.method1() \l 3. method2()"] ClassB->ClassA} } }}} |
GraphViz
Graphviz is open source graph visualization software. Graph visualization is a way of representing structural information as diagrams of abstract graphs and networks. It has important applications in networking, bioinformatics, software engineering, database and web design, machine learning, and in visual interfaces for other technical domains.
http://www.tonyballantyne.com/graphs.html
Slackware64 14.1 install
- cd /tmp
wget http://slackbuilds.org/slackbuilds/13.0/graphics/graphviz.tar.gz
- tar xvzf graphviz.tar.gz
- cd graphviz
wget http://graphviz.org/pub/graphviz/stable/SOURCES/graphviz-2.26.3.tar.gz
GraphViz for MoinMoin
http://moinmo.in/GraphVizForMoin
- cd /tmp
unzip MoinGraphViz-1.0rc4-brn-1.9.x.comp.zip
- cd/tmp/MoinGraphViz-1.0rc4-brn-1.9.x.comp/wiki/data/plugin
- cp * -r /home/moin/moin-1.9.7/wiki/data/plugin/
- cd /home/moin/moin-1.9.7/wiki/data/plugin/
- chown moin * -R
- chgrp apache * -R
- cd/tmp/MoinGraphViz-1.0rc4-brn-1.9.x.comp/umoin
cp MoinLegacy /home/moin/moin-1.9.7/MoinMoin/support/
- cd /home/moin/moin-1.9.7/MoinMoin/support/
- chown moin * -R
- chgrp apache * -R
- yum install graphviz
- vim /home/moin/moin-1.9.7/wiki/data/plugin/parser/MoinGraphViz/main-py # GRAPHVIZ_TOOLS_DIR = r'/usr/bin'
- service httpd restart
Windows configuration
On file <...>moin-1.9.7\wiki\data\plugin\parser\MoinGraphViz\main.py change in line 254 from close_fds=True to close_ds=False, due to error launched in Windows.
1 def oscmd(cmd):
2 '''instead of simply calling os.system(cmd)
3 capture stderr and raise GraphvizRenderError if exit code != 0
4 '''
5 p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True,
6 bufsize=1024, close_fds=False)
7 stdo, stde = p.communicate()
8
9 if p.returncode != 0:
10 raise GraphvizRenderError("%s\n%s" % (stdo, stde))
Test after installation
If all was installed correctly a graph should appear below
Sample 1
UML with GraphViz
UML Sample 1
http://www.ffnn.nl/pages/articles/media/uml-diagrams-using-graphviz-dot.php
UML Sample 2
http://www.lornajane.net/posts/2011/uml-diagrams-with-graphviz
UML Sample 3
http://canvoki.net/coder/resources/DotUmlUseCases.html
http://canvoki.net/coder/DotUseCases/MarUseCases.dot
UML Sample 4
http://fsteeg.wordpress.com/2006/11/16/uml-activity-diagrams-with-graphviz/
digraph untitled { rankdir=TD size="4,4" edge[fontsize="11" arrowhead=open] start[shape=circle, label="", style=filled] end[shape=doublecircle, label="", style=filled] action1[shape=box,style=rounded, label="action"] action2[shape=box,style=rounded, label="action"] action3[shape=box,style=rounded, label="action"] if1[shape=diamond, label="decision"] if2[shape=diamond, label="decision"] start -> action1 action1 -> if1[headport=n] if1 -> action2[label="condition" tailport=w] if1 -> action3[taillabel="condition" labeldistance=2.5 tailport=e] action2 -> if2[headport=w] action3 -> if2[headport=e] if2 -> end[taillabel="condition"] }