gvgen-0.9/0000755000175000017500000000000010760567026011523 5ustar toadytoadygvgen-0.9/setup.py0000755000175000017500000000020510760565365013241 0ustar toadytoady#!/usr/bin/python from distutils.core import setup setup(name="GvGen", version="0.9", py_modules=["gvgen"]) gvgen-0.9/docs/0000755000175000017500000000000010760566432012453 5ustar toadytoadygvgen-0.9/docs/user-guide.tex.lyx0000644000175000017500000000462110760565365016070 0ustar toadytoady#LyX 1.5.1 created this file. For more info see http://www.lyx.org/ \lyxformat 276 \begin_document \begin_header \textclass article \language english \inputencoding auto \font_roman default \font_sans default \font_typewriter default \font_default_family default \font_sc false \font_osf false \font_sf_scale 100 \font_tt_scale 100 \graphics default \paperfontsize default \papersize default \use_geometry false \use_amsmath 1 \use_esint 1 \cite_engine basic \use_bibtopic false \paperorientation portrait \secnumdepth 3 \tocdepth 3 \paragraph_separation indent \defskip medskip \quotes_language english \papercolumns 1 \papersides 1 \paperpagestyle default \tracking_changes false \output_changes false \author "" \end_header \begin_body \begin_layout Title GvGen User Documentation \end_layout \begin_layout Author Sebastien Tricaud \end_layout \begin_layout Section* Introduction \end_layout \begin_layout Standard GvGen is a python class to produce dot language for easy scripting. It is not a replacement for existing Graphviz bindings, but a dot language generator, that you must then process with graphviz tools to get you graph as a pixmap. \end_layout \begin_layout Section* Getting started \end_layout \begin_layout Standard First of all, you must get the latest stable release from INL software repositor y \begin_inset Foot status open \begin_layout Standard http://software.inl.fr/releases/GvGen/ \end_layout \end_inset . After that you need to uncompress the file and install it: \end_layout \begin_layout LyX-Code $ tar xfz gvgen-1.0.tar.gz \end_layout \begin_layout LyX-Code $ cd gvgen-1.0 \end_layout \begin_layout LyX-Code # python ./setup.py install \end_layout \begin_layout Standard Congratulations! You can now start using GvGen. To test if you installation is working, you can run the following: \end_layout \begin_layout LyX-Code $ python \end_layout \begin_layout LyX-Code >>> import gvgen \end_layout \begin_layout LyX-Code >>> graph = gvgen.GvGen() \end_layout \begin_layout LyX-Code >>> graph.dot() \end_layout \begin_layout LyX-Code digraph G { \end_layout \begin_layout LyX-Code } \end_layout \begin_layout LyX-Code >>> \end_layout \begin_layout Standard As you can see, the output \begin_inset Quotes eld \end_inset digraph G { } \begin_inset Quotes erd \end_inset acknowledges the fact GvGen is working, we can now move on and start using it. \end_layout \end_body \end_document gvgen-0.9/examples/0000755000175000017500000000000010760570326013336 5ustar toadytoadygvgen-0.9/examples/properties-link.py0000755000175000017500000000124210760565365017050 0ustar toadytoady#!/usr/bin/python import gvgen graph = gvgen.GvGen() parents = graph.newItem("Parents") father = graph.newItem("Bob", parents) mother = graph.newItem("Alice", parents) children = graph.newItem("Children") child1 = graph.newItem("Carol", children) child2 = graph.newItem("Eve", children) child3 = graph.newItem("Isaac", children) postman = graph.newItem("Postman") mylink = graph.newLink(father,child1) graph.propertyAppend(mylink, "color", "#158510") graph.propertyAppend(mylink, "label", "first") graph.newLink(father,child2) graph.newLink(mother,child2) graph.newLink(mother,child1) graph.newLink(mother,child3) graph.newLink(postman,child3) graph.dot() gvgen-0.9/examples/legend.py0000755000175000017500000000117010760565365015157 0ustar toadytoady#!/usr/bin/python import gvgen # Creates the new graph instance graph = gvgen.GvGen("Legend") # Creates two items labeled "Foo" and "Bar" a = graph.newItem("foo") b = graph.newItem("bar") # Links from "foo" to "bar" graph.newLink(a,b) graph.styleAppend("foostyle","color","red") graph.styleAppend("foostyle","shape","rectangle") graph.styleApply("foostyle", a) graph.styleAppend("barstyle","color","blue") graph.styleAppend("barstyle","style","filled") graph.styleApply("barstyle", b) graph.legendAppend("foostyle", "Foo item") graph.legendAppend("barstyle", "This is the bar item") # Outputs the graphviz code graph.dot() gvgen-0.9/examples/ex4.py0000755000175000017500000000150010760565365014416 0ustar toadytoady#!/usr/bin/python import gvgen if __name__ == "__main__": graph = gvgen.GvGen() parents = graph.newItem("Parents") father = graph.newItem("Bob", parents) mother = graph.newItem("Alice", parents) children = graph.newItem("Children") child1 = graph.newItem("Carol", children) child2 = graph.newItem("Eve", children) child3 = graph.newItem("Isaac", children) postman = graph.newItem("Postman") graph.newLink(father,child1) graph.newLink(father,child2) graph.newLink(mother,child2) graph.newLink(mother,child1) graph.newLink(mother,child3) graph.newLink(postman,child3) graph.styleAppend("Post", "color", "blue") graph.styleAppend("Post", "style", "filled") graph.styleAppend("Post", "shape", "rectangle") graph.styleApply("Post", postman) graph.dot() gvgen-0.9/examples/smartmode-links.py0000755000175000017500000000065510760565365017041 0ustar toadytoady#!/usr/bin/python import gvgen # Creates the new graph instance graph = gvgen.GvGen() # We activate the smart mode graph.smart_mode = 1 # Creates two items labeled "Foo" and "Bar" a = graph.newItem("foo") b = graph.newItem("bar") # Links from "foo" to "bar" graph.newLink(a,b) # Links from "bar" to "foo" graph.newLink(b,a) graph.newLink(b,a) graph.newLink(b,a) graph.newLink(b,a) # Outputs the graphviz code graph.dot() gvgen-0.9/examples/parents.py0000755000175000017500000000112710760565365015377 0ustar toadytoady#!/usr/bin/python import gvgen # Creates the new graph instance graph = gvgen.GvGen() # Creates two items labeled "Foo" and "Bar" ggggp = graph.newItem("grand grand grand grand parent") gggp = graph.newItem("grand grand grand parent", ggggp) ggp = graph.newItem("grand grand parent", gggp) gp = graph.newItem("grand parent", ggp) p = graph.newItem("parent", gp) c1 = graph.newItem("child 1", p) c2 = graph.newItem("child 2", p) # Links from "foo" to "bar" graph.newLink(c1,c2) tof = graph.newItem("this other family") graph.newItem("The children", tof) # Outputs the graphviz code graph.dot() gvgen-0.9/examples/unix-family.py0000755000175000017500000000572210760565365016172 0ustar toadytoady#!/usr/bin/python # # Outputs the Unix Family 'Tree', such as shown in: # http://www.graphviz.org/Gallery/directed/unix.html # import gvgen graph = gvgen.GvGen() graph.styleDefaultAppend("color","lightblue2") graph.styleDefaultAppend("style","filled") cbunix1 = graph.newItem("CB Unix 1") cbunix2 = graph.newItem("CB Unix 2") cbunix3 = graph.newItem("CB Unix 3") interdata = graph.newItem("Interdata") lsx = graph.newItem("LSX") miniunix = graph.newItem("Mini Unix") n1bsd = graph.newItem("1 BSD") n28bsd = graph.newItem("2.8 BSD") n29bsd = graph.newItem("2.9 BSD") n2bsd = graph.newItem("2 BSD") n32v = graph.newItem("32V") n3bsd = graph.newItem("3 BSD") n41bsd = graph.newItem("4.1 BSD") n42bsd = graph.newItem("4.2 BSD") n43bsd = graph.newItem("4.3 BSD") n4bsd = graph.newItem("4 BSD") n5th = graph.newItem("5th Edition") n6th = graph.newItem("6th Edition") n7th = graph.newItem("7th Edition") n8th = graph.newItem("8th Edition") n9th = graph.newItem("9th Edition") pdp11 = graph.newItem("PDP-11 Sys V") pwb10 = graph.newItem("PWB 1.0") pwb12 = graph.newItem("PWB 1.2") pwb20 = graph.newItem("PWB 2.0") sys0 = graph.newItem("System V.0") sys2 = graph.newItem("System V.2") sys3 = graph.newItem("System V.3") ts40 = graph.newItem("TS 4.0") ultrix11 = graph.newItem("Ultrix-11") ultrix32 = graph.newItem("Ultrix-32") uniplus = graph.newItem("UniPlus+") unixts10 = graph.newItem("Unix/TS 1.0") unixts30 = graph.newItem("Unix/TS 3.0") unixtspp = graph.newItem("Unix/TS++") usg10 = graph.newItem("USG 1.0") usg20 = graph.newItem("USG 2.0") usg30 = graph.newItem("USG 3.0") v7m = graph.newItem("V7M") wollongong = graph.newItem("Wollongong") xenix = graph.newItem("Xenix") graph.newLink(n5th,n6th) graph.newLink(n5th,pwb10) graph.newLink(pwb10,pwb12) graph.newLink(pwb10,usg10) graph.newLink(n6th,n1bsd) graph.newLink(n6th,interdata) graph.newLink(n6th,miniunix) graph.newLink(n6th,wollongong) graph.newLink(n6th,lsx) graph.newLink(interdata,n7th) graph.newLink(interdata,pwb20) graph.newLink(pwb12,pwb20) graph.newLink(usg10,usg20) graph.newLink(usg10,cbunix1) graph.newLink(n7th,xenix) graph.newLink(n7th,uniplus) graph.newLink(n7th,n32v) graph.newLink(usg20,usg30) graph.newLink(cbunix1,cbunix2) graph.newLink(n7th,v7m) graph.newLink(n32v,n3bsd) graph.newLink(interdata,unixts30) graph.newLink(usg30,unixts30) graph.newLink(unixts10,unixts30) graph.newLink(cbunix2,cbunix3) graph.newLink(n3bsd,n4bsd) graph.newLink(cbunix3,unixtspp) graph.newLink(cbunix3,pdp11) graph.newLink(n1bsd,n2bsd) graph.newLink(n4bsd,n41bsd) graph.newLink(unixts30,ts40) graph.newLink(cbunix3,ts40) graph.newLink(unixtspp,ts40) graph.newLink(n2bsd,n28bsd) graph.newLink(n41bsd,n28bsd) graph.newLink(n41bsd,n42bsd) graph.newLink(n41bsd,n8th) graph.newLink(ts40,sys0) graph.newLink(v7m,ultrix11) graph.newLink(n7th,ultrix11) graph.newLink(n28bsd,ultrix11) graph.newLink(n28bsd,n29bsd) graph.newLink(n42bsd,ultrix32) graph.newLink(n42bsd,n43bsd) graph.newLink(n8th,n9th) graph.newLink(sys0,sys2) graph.newLink(sys2,sys3) graph.dot() gvgen-0.9/examples/legendin.py0000755000175000017500000000117410760565365015512 0ustar toadytoady#!/usr/bin/python import gvgen # Creates the new graph instance graph = gvgen.GvGen("Legend") # Creates two items labeled "Foo" and "Bar" a = graph.newItem("foo") b = graph.newItem("bar") # Links from "foo" to "bar" graph.newLink(a,b) graph.styleAppend("foostyle","color","red") graph.styleAppend("foostyle","shape","rectangle") graph.styleApply("foostyle", a) graph.styleAppend("barstyle","color","blue") graph.styleAppend("barstyle","style","filled") graph.styleApply("barstyle", b) graph.legendAppend("foostyle", "Foo item",1) graph.legendAppend("barstyle", "This is the bar item",1) # Outputs the graphviz code graph.dot() gvgen-0.9/examples/ex3.py0000755000175000017500000000120510760565365014417 0ustar toadytoady#!/usr/bin/python import gvgen if __name__ == "__main__": graph = gvgen.GvGen() parents = graph.newItem("Parents") father = graph.newItem("Bob", parents) mother = graph.newItem("Alice", parents) children = graph.newItem("Children") child1 = graph.newItem("Carol", children) child2 = graph.newItem("Eve", children) child3 = graph.newItem("Isaac", children) postman = graph.newItem("Postman") graph.newLink(father,child1) graph.newLink(father,child2) graph.newLink(mother,child2) graph.newLink(mother,child1) graph.newLink(mother,child3) graph.newLink(postman,child3) graph.dot() gvgen-0.9/examples/build.sh0000755000175000017500000000065310760565365015007 0ustar toadytoady#!/bin/bash function build() { FILE=$1 echo "Building $FILE..." python $FILE.py > $FILE.dot dot -Tpng $FILE.dot > $FILE.png } build edges-linking build ex1 build ex2 build ex3 build ex4 build ex5 build ex6 build ex7 build legend build legendin build multiples-parents-children-simple build parents build properties-link build smartmode-links build smartmode-links-2 build smartmode-links-3 build unix-family gvgen-0.9/examples/smartmode-links-2.py0000755000175000017500000000060110760565365017167 0ustar toadytoady#!/usr/bin/python import gvgen # Creates the new graph instance graph = gvgen.GvGen() # We activate the smart mode graph.smart_mode = 1 graph.max_line_width = 2 graph.max_arrow_width = 1 # Creates two items labeled "Foo" and "Bar" a = graph.newItem("foo") b = graph.newItem("bar") graph.newLink(b,a) graph.newLink(b,a) graph.newLink(b,a) # Outputs the graphviz code graph.dot() gvgen-0.9/examples/ex2.py0000755000175000017500000000053310760565365014421 0ustar toadytoady#!/usr/bin/python from gvgen import * graph = GvGen() parents = graph.newItem("Parents") father = graph.newItem("Bob", parents) mother = graph.newItem("Alice", parents) children = graph.newItem("Children") child1 = graph.newItem("Carol", children) child2 = graph.newItem("Eve", children) child3 = graph.newItem("Isaac", children) graph.dot() gvgen-0.9/examples/ex6.py0000755000175000017500000000143010760565365014422 0ustar toadytoady#!/usr/bin/python import gvgen if __name__ == "__main__": graph = gvgen.GvGen() parents = graph.newItem("Parents") father = graph.newItem("Bob", parents) mother = graph.newItem("Alice", parents) children = graph.newItem("Children") child1 = graph.newItem("Carol", children) child2 = graph.newItem("Eve", children) child3 = graph.newItem("Isaac", children) postman = graph.newItem("Postman") graph.newLink(father,child1) graph.newLink(father,child2) graph.newLink(mother,child2) graph.newLink(mother,child1) graph.newLink(mother,child3) graph.newLink(postman,child3) graph.propertyForeachLinksAppend(father, "label", "This is the name of my link") graph.propertyForeachLinksAppend(father, "color", "red") graph.dot() gvgen-0.9/examples/smartmode-links-3.py0000755000175000017500000000060410760565365017173 0ustar toadytoady#!/usr/bin/python import gvgen # Creates the new graph instance graph = gvgen.GvGen() # We activate the smart mode graph.smart_mode = 1 graph.line_factor = 3 graph.arrow_factor = 1 # Creates two items labeled "Foo" and "Bar" a = graph.newItem("foo") b = graph.newItem("bar") # Links from "foo" to "bar" graph.newLink(a,b) graph.newLink(a,b) # Outputs the graphviz code graph.dot() gvgen-0.9/examples/ex1.py0000755000175000017500000000042110760565365014414 0ustar toadytoady#!/usr/bin/python import gvgen # Creates the new graph instance graph = gvgen.GvGen() # Creates two items labeled "Foo" and "Bar" a = graph.newItem("foo") b = graph.newItem("bar") # Links from "foo" to "bar" graph.newLink(a,b) # Outputs the graphviz code graph.dot() gvgen-0.9/examples/edges-linking.py0000755000175000017500000000107110760565365016441 0ustar toadytoady#!/usr/bin/python import gvgen graph = gvgen.GvGen() parents = graph.newItem("Parents") father = graph.newItem("Bob", parents) mother = graph.newItem("Alice", parents) children = graph.newItem("Children") child1 = graph.newItem("Carol", children) child2 = graph.newItem("Eve", children) child3 = graph.newItem("Isaac", children) postman = graph.newItem("Postman") graph.newLink(father,child1) graph.newLink(father,child2) graph.newLink(mother,child2) graph.newLink(mother,child1) graph.newLink(mother,child3) graph.newLink(postman,child3) graph.dot() gvgen-0.9/examples/network/0000755000175000017500000000000010760570211015020 5ustar toadytoadygvgen-0.9/examples/network/hurd.png0000644000175000017500000000147610760567101016504 0ustar toadytoadyPNG  IHDRg pHYsHHFk>IDAT8}K*QݴZH%-{h"YIfn jQD-*e&iC:q3s>=h/pZӢR߈F>r7u:ǁٽ=j/<i fQ8H'1N'i.,JH XXodhr:)}}T"qss''piT++j5A("HE>u NO77s_.X"SagIENDB`gvgen-0.9/examples/network/linux.png0000644000175000017500000000200110760567101016662 0ustar toadytoadyPNG  IHDR6n֖ pHYsHHFk>IDATHǽW_HZa?e4N6ƪLJ|h9 L6ЇCA(k,b#p|pl{2قd/ǒ  "n`bLW7޶|;GfдN pXL.b8 4F;;h4h{I9q٭w/J8&Nhp4a]@:Ͳ]N/^TϜYXxBccmm w aɤɤݾٳgR).~%--ŃT"ꗖHoBll4t:z{QE?|{ rtC" Y`|f}eY~d2L6f<+Uu204}}ιs EQ%c08ɸ1E߼)(HW%ؚe~ %].plF;J䬦&*Em: network.dot $ dot -Tpng network.dot > network.png # Symetric view, no parents organisation $ ./network.py > network.dot $ neato -Tpng network.dot > network.png gvgen-0.9/examples/network/sun.png0000644000175000017500000000064710760567101016346 0ustar toadytoadyPNG  IHDR6n֖ pHYsHHFk>YIDATHŗ0 EX #,Cd> PU؏ <^x>t5kM1ka|uJ)8c sH܆wtT"q6ju(߫6Y)ZEcKc/GbTò%@œASV8v \roh&+Zm,Le_jqM!.@zk-IENDB`gvgen-0.9/examples/network/network.png0000644000175000017500000003136410760570233017232 0ustar toadytoadyPNG  IHDRPdbKGDtIME-ۛ IDATxy\T?0,* .j/)a*v5M٢ݟڢF@435䒈 *Ȧ,2eg朙npy|>BHJ "CDDad:DD$ICDDad:DD$ICDDad:DD$ICDD˛׮]#GW-DDd6o|SO'&&QQQuY: DDDu3DDd"##\mpL$!""0tH2 "" C$!""0tH2uN& BzvU,v}k͸OHNٕ>I}A"C{~D CHB j8Cl\ E{5T^^Y}}"KɢΪQ{jNUAej5mVM+{m5)^C!^j:r@}UB6P׉ 쪻ޤ]?Rk\g֫rS^XN}l$tH2 "" C$!""0tH2 "" C$!""0tH2 "" C$!""0tH2 "" C$!""HI&IՔ՚7oylf9it%UsV'** f>ո//s$}\uDDljH\zqˋ_^Rb!""0tH2 "" C$!""0tH2 "" C$!""0tH2\eҺ-޽{b 5Bf뽶_^ L0~~~P(Ƕm!쐞ɓ'cر%9͛7dz>aÆ>C^^ТE ='O6 E[ HIIu{nڵ :$%ȑڅ/˖-C||<Ñ"ϭiO`7 dȗDT8Νî]^\1czjZ ݺuԩS`T؞,X?~~sNWb/F:Iؖw_ߒoų.\x899a̙Gtx8{ HJWOc͛Xf #Gi-8 ;wC}|Z1g.T. $''/6mڄ,<쳘8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`}?e%"7_@ROW This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. """ from sys import stdout gvgen_version = "0.9" debug = 0 debug_tree_unroll = 0 class GvGen: """ Graphviz dot language Generation Class For example of usage, please see the __main__ function """ def __init__(self, legend_name=None, options="compound=true;"): # allow links between clusters self.max_line_width = 10 self.max_arrow_width = 2 self.line_factor = 1 self.arrow_factor = 0.5 self.initial_line_width = 1.2 self.initial_arrow_width = 0.8 self.options = options self.__id = 0 self.__nodes = [] self.__links = [] self.__browse_level = 0 # Stupid depth level for self.browse self.__opened_braces = [] # We count opened clusters self.fd=stdout # File descriptor to output dot self.padding_str=" " # Left padding to make children and parent look nice self.__styles = {} self.__default_style = [] self.smart_mode = 0 # Disabled by default # The graph has a legend if legend_name: self.options = self.options + "rankdir=LR;" self.legend = self.newItem(legend_name) def __node_new(self, name, parent=None, distinct=None): """ Create a new node in the data structure @name: Name of the node, that will be the graphviz label @parent: The node parent @distinct: if true, will not create and node that has the same name Returns: The node created """ # We first check for distincts if distinct: if self.__nodes: for e in self.__nodes: props = e['properties'] if props['label'] == name: # We found the label name matching, we return -1 return -1 # We now insert into gvgen datastructure self.__id += 1 node = {'id': self.__id, # Internal ID 'lock': 0, # When the node is written, it is locked to avoid further references 'parent': parent, # Node parent for easy graphviz clusters 'style':None, # Style that GvGen allow you to create 'properties': { # Custom graphviz properties you can add, which will overide previously defined styles 'label': name } } # Parents should be sorted first if parent: self.__nodes.insert(1, node) else: self.__nodes.append(node) return node def __link_smart(self, link): """ Creates a smart link if smart_mode activated: if a -> b exists, and we now add a <- b, instead of doing: a -> b <- we do: a <-> b """ linkfrom = self.__link_exists(link['from_node'], link['to_node']) linkto = self.__link_exists(link['to_node'], link['from_node']) if self.smart_mode: if linkto: self.__links.remove(linkto) self.propertyAppend(link, "dir", "both") pw = self.propertyGet(linkfrom, "penwidth") if pw: pw = float(pw) pw += self.line_factor if pw < self.max_line_width: self.propertyAppend(linkfrom, "penwidth", str(pw)) else: self.propertyAppend(link, "penwidth", str(self.initial_line_width)) aw = self.propertyGet(linkfrom, "arrowsize") if aw: aw = float(aw) if aw < self.max_arrow_width: aw += self.arrow_factor self.propertyAppend(linkfrom, "arrowsize", str(aw)) else: self.propertyAppend(link, "arrowsize", str(self.initial_arrow_width)) if not linkfrom: self.__links.append(link) def __link_new(self, from_node, to_node, label = None, cl_from_node=None, cl_to_node=None): """ Creates a link between two nodes @from_node: The node the link comes from @to_node: The node the link goes to Returns: The link created """ link = {'from_node': from_node, 'to_node': to_node, 'style':None, # Style that GvGen allow you to create 'properties': {}, # Custom graphviz properties you can add, which will overide previously defined styles 'cl_from_node':None, # When linking from a cluster, the link appears from this node 'cl_to_node':None, # When linking to a cluster, the link appears to go to this node } if label: link['properties']['label'] = label if cl_from_node: link['cl_from_node'] = cl_from_node if cl_to_node: link['cl_to_node'] = cl_to_node # We let smart link work for us self.__link_smart(link) return link def __link_exists(self, from_node, to_node): """ Find if a link exists @from_node: The node the link comes from @to_node: The node the link goes to Returns: true if the given link already exists """ for link in self.__links: if link['from_node'] == from_node and link['to_node'] == to_node: return link return None def __has_children(self, parent): """ Find children to a given parent Returns the children list """ children_list = [] for e in self.__nodes: if e['parent'] == parent: children_list.append(e) return children_list def newItem(self, name, parent=None, distinct=None): node = self.__node_new(name, parent, distinct) return node def newLink(self, src, dst, label=None, cl_src=None, cl_dst=None): """ Link two existing nodes with each other """ return self.__link_new(src, dst, label, cl_src, cl_dst) def debug(self): for e in self.__nodes: print "element = " + str(e['id']) def collectLeaves(self, parent): """ Collect every leaf sharing the same parent """ cl = [] for e in self.__nodes: if e['parent'] == parent: cl.append(e) return cl def collectUnlockedLeaves(self, parent): """ Collect every leaf sharing the same parent unless it is locked """ cl = [] for e in self.__nodes: if e['parent'] == parent: if not e['lock']: cl.append(e) return cl def lockNode(self, node): node['lock'] = 1 # # Start: styles management # def styleAppend(self, stylename, key, val): if stylename not in self.__styles: self.__styles[stylename] = [] self.__styles[stylename].append([key, val]) def styleApply(self, stylename, node_or_link): node_or_link['style'] = stylename def styleDefaultAppend(self, key, val): self.__default_style.append([key, val]) # # End: styles management # # # Start: properties management # def propertiesAsStringGet(self, node, props): """ Get the properties string according to parent/children props is the properties dictionnary """ allProps = {} # # Default style come first, they can then be overriden # if self.__default_style: allProps.update(self.__default_style) # # First, we build the styles # if node['style']: stylename = node['style'] allProps.update(self.__styles[stylename]) # # Now we build the properties: # remember they override styles # allProps.update(props) if self.__has_children(node): propStringList = ["%s=\"%s\";\n" % (k, v) for k, v in allProps.iteritems()] properties = ''.join(propStringList) else: if props: propStringList = ["%s=\"%s\"" % (k, v) for k, v in allProps.iteritems()] properties = '[' + ','.join(propStringList) + ']' else: properties = '' return properties def propertiesLinkAsStringGet(self, link): has_props = 0 props = {} if link['style']: stylename = link['style'] # Build the properties string for node props.update(self.__styles[stylename]) props.update(link['properties']) properties = '' if props: properties += ','.join(["%s=\"%s\"" % (str(k),str(val)) for k, val in props.iteritems()]) return properties def propertyForeachLinksAppend(self, node, key, val): for l in self.__links: if l['from_node'] == node: props = l['properties'] props[key] = val def propertyAppend(self, node_or_link, key, val): """ Append a property to the wanted node or link mynode = newItem(\"blah\") Ex. propertyAppend(mynode, \"color\", \"red\") """ props = node_or_link['properties'] props[key] = val def propertyGet(self, node_or_link, key): """ Get the value of a given property Ex. prop = propertyGet(node, \"color\") """ try: props = node_or_link['properties'] return props[key] except: return None def propertyRemove(self, node_or_link, key): """ Remove a property to the wanted node or link mynode = newItem(\"blah\") Ex. propertyRemove(mynode, \"color\") """ props = node_or_link['properties'] del props[key] # # End: Properties management # # # For a good legend, the graph must have # rankdir=LR property set. # def legendAppend(self, legendstyle, legenddescr, labelin=None): if labelin: item = self.newItem(legenddescr, self.legend) self.styleApply(legendstyle, item) else: style = self.newItem("", self.legend) descr = self.newItem(legenddescr, self.legend) self.styleApply(legendstyle, style) link = self.newLink(style,descr) self.propertyAppend(link, "dir", "none") self.propertyAppend(link, "style", "invis") self.propertyAppend(descr,"shape","plaintext") def tree_debug(self, level, node, children): if children: print "(level:%d) Eid:%d has children (%s)" % (level,node['id'],str(children)) else: print "Eid:"+str(node['id'])+" has no children" # # Core function that outputs the data structure tree into dot language # def tree(self, level, node, children): """ Core function to output dot which sorts out parents and children and do it in the right order """ if debug: print "/* Grabed node = %s*/" % str(node['id']) if node['lock'] == 1: # The node is locked, nothing should be printed if debug: print "/* The node (%s) is locked */" % str(node['id']) if self.__opened_braces: self.fd.write(level * self.padding_str) self.fd.write("}\n") self.__opened_braces.pop() return props = node['properties'] if children: node['lock'] = 1 self.fd.write(level * self.padding_str) self.fd.write(self.padding_str + "subgraph cluster%d {\n" % node['id']) properties = self.propertiesAsStringGet(node, props) self.fd.write(level * self.padding_str) self.fd.write(self.padding_str + "%s" % properties) self.__opened_braces.append([node,level]) else: # We grab appropriate properties properties = self.propertiesAsStringGet(node, props) # We get the latest opened elements if self.__opened_braces: last_cluster,last_level = self.__opened_braces[-1] else: last_cluster = None last_level = 0 if debug: if node['parent']: parent_str = str(node['parent']['id']) else: parent_str = 'None' if last_cluster: last_cluster_str = str(last_cluster['id']) else: last_cluster_str = 'None' print "/* e[parent] = %s, last_cluster = %s, last_level = %d, opened_braces: %s */" % (parent_str, last_cluster_str,last_level,str(self.__opened_braces)) # Write children/parent with properties if node['parent']: if node['parent'] != last_cluster: while node['parent'] < last_cluster: last_cluster,last_level = self.__opened_braces[-1] if node['parent'] == last_cluster: last_level += 1 # We browse any property to build a string self.fd.write(last_level * self.padding_str) self.fd.write(self.padding_str + "node%d %s;\n" % (node['id'], properties)) node['lock'] = 1 else: self.fd.write(last_level * self.padding_str) self.fd.write(self.padding_str + "}\n") self.__opened_braces.pop() else: self.fd.write(level * self.padding_str) self.fd.write(self.padding_str + "node%d %s;\n" % (node['id'], properties) ) node['lock'] = 1 cl = self.collectUnlockedLeaves(node['parent']) for l in cl: props = l['properties'] properties = self.propertiesAsStringGet(l, props) self.fd.write(last_level * self.padding_str) self.fd.write(self.padding_str + self.padding_str + "node%d %s;\n" % (l['id'], properties)) node['lock'] = 1 self.lockNode(l) self.fd.write(level * self.padding_str + "}\n") self.__opened_braces.pop() else: self.fd.write(self.padding_str + "node%d %s;\n" % (node['id'], properties)) node['lock'] = 1 def browse(self, node, cb): """ Browse nodes in a tree and calls cb providing node parameters """ children = self.__has_children(node) if children: cb(self.__browse_level, node, str(children)) for c in children: self.__browse_level += 1 self.browse(c, cb) else: cb(self.__browse_level, node, None) self.__browse_level = 0 # if debug: # print "This node is not a child: " + str(node) def dotLinks(self, node): """ Write links between nodes """ for l in self.__links: if l['from_node'] == node: # Check if we link form a cluster children = self.__has_children(node) if children: if l['cl_from_node']: src = l['cl_from_node']['id'] else: src = children[0]['id'] cluster_src = node['id'] else: src = node['id'] cluster_src = '' # Check if we link to a cluster children = self.__has_children(l['to_node']) if children: if l['cl_to_node']: dst = l['cl_to_node']['id'] else: dst = children[0]['id'] cluster_dst = l['to_node']['id'] else: dst = l['to_node']['id'] cluster_dst = '' self.fd.write("node%d->node%d" % (src, dst)) props = self.propertiesLinkAsStringGet(l) # Build new properties if we link from or to a cluster if cluster_src: if props: props += ',' props += "ltail=cluster%d" % cluster_src if cluster_dst: if props: props += ',' props += "lhead=cluster%d" % cluster_dst if props: self.fd.write(" [%s]" % props) self.fd.write(";\n") def dot(self, fd=stdout): """ Translates the datastructure into dot """ try: self.fd = fd self.fd.write("/* Generated by GvGen v.%s (http://software.inl.fr/trac/wiki/GvGen) */\n\n" % (gvgen_version)) self.fd.write("digraph G {\n") if self.options: self.fd.write(self.options+"\n") # We write parents and children in order for e in self.__nodes: if debug_tree_unroll: self.browse(e, self.tree_debug) else: self.browse(e, self.tree) # We write the connection between nodes for e in self.__nodes: self.dotLinks(e) # We put all the nodes belonging to the parent self.fd.write("}\n") finally: # Remove our reference to file descriptor self.fd = None if __name__ == "__main__": graph = GvGen() graph.smart_mode = 1 graph.styleDefaultAppend("color","blue") parents = graph.newItem("Parents") father = graph.newItem("Bob", parents) mother = graph.newItem("Alice", parents) children = graph.newItem("Children") child1 = graph.newItem("Carol", children) child2 = graph.newItem("Eve", children) child3 = graph.newItem("Isaac", children) postman = graph.newItem("Postman") graph.newLink(father,child1) graph.newLink(child1, father) graph.newLink(father, child1) graph.newLink(father,child2) graph.newLink(mother,child2) myl = graph.newLink(mother,child1) graph.newLink(mother,child3) graph.newLink(postman,child3,"Email is safer") graph.newLink(parents, postman) # Cluster link graph.propertyForeachLinksAppend(parents, "color", "blue") graph.propertyForeachLinksAppend(father, "label", "My big link") graph.propertyForeachLinksAppend(father, "color", "red") graph.propertyAppend(postman, "color", "red") graph.propertyAppend(postman, "fontcolor", "white") graph.styleAppend("link", "label", "mylink") graph.styleAppend("link", "color", "green") graph.styleApply("link", myl) graph.propertyAppend(myl, "arrowhead", "empty") graph.styleAppend("Post", "color", "blue") graph.styleAppend("Post", "style", "filled") graph.styleAppend("Post", "shape", "rectangle") graph.styleApply("Post", postman) graph.dot() gvgen-0.9/ChangeLog0000644000175000017500000000673310760565365013312 0ustar toadytoady2008-02-25 Sebastien Tricaud * gvgen.py: * Removed deprecated functions for GvGlue * Add version banner in generated dot * Have smart mode working the way I wanted to * Release 0.9 "25 ways to use it!" 2008-02-07 Sebastien Tricaud * gvgen.py: put locks at the right place to fix a regression bug introduced in 0.8. * examples/ex3.py: Added * examples/ex4.py: Added * examples/ex5.py: Added * examples/ex6.py: Added * examples/ex7.py: Added 2008-01-11 Sebastien Tricaud * Release 0.8 2008-01-10 Sebastien Tricaud * gvgen.py: * Fixed a bug shown when dealing with multiple parents and children. * Add a serious tricky-working way to deal with graphviz and a legend. This is a great feature graphviz does not have natively! * examples/legend.py: Alerted to reflect the reality * examples/legendin.py: Added * examples/multiples-parents-children-simple.py: Added to avoid regressions 2008-01-09 Sebastien Tricaud * gvgen.py: s/edge/node/ 2007-12-31 Sebastien Tricaud * gvgen.py: Added the LegendAppend() function to easily create legends * examples/legend.py: Added 2007-12-13 Sebastien Tricaud * gvgen.py: Applied patch from LDiracDelta that fix the multiple call graph generation issue 2007-12-13 Sebastien Tricaud * examples/unix-family.py: Added * gvgen.py: fixed the ';' for the compound mode * setup.py: Build for 0.8 2007-12-12 Sebastien Tricaud * Release 0.7 2007-12-06 Laurent Defert * gvgen.py: Patch from Walther Zwart 2007-11-26 Sebastien Tricaud * gvgen.py: Added patch from Laurent Defert which allows links between clusters and nodes regarless their nature 2007-11-19 Sebastien Tricaud * examples/parents.py: Added * examples/build.sh: Added * gvgen.py: Fixed the bug of not closing a parent when we've got several (!) 2007-11-12 Sebastien Tricaud * gvgen.py: Add propertyGet() function 2007-11-09 Sebastien Tricaud * gvgen.py: * Use python objects for nodes instead of id, styleApplyToLink() got removed, enhancement provided by the patch sent by Walther Zwart * Add propertyRemove() function * Smart mode: deactivated by default (changes default graphviz behavior), to ease some operations, such as double arrows instead of doing links in both ways 2007-11-08 Sebastien Tricaud * gvgen.py: Add the capability to apply styles to links with styleApplyToLink(), feature added by the patch sent by Walther Zwart 2007-10-18 Sebastien Tricaud * gvgen.py: Can define a style as default to be applied everywhere (styleDefaultAppend()) 2007-10-18 Sebastien Tricaud * gvgen.py: Support for distinct use of edges * setup.py: Creation * examples/ex1.py: Creation 2007-10-17 Victor Stinner * gvgen.py: remove reference to file descriptor on exit (always) Fix/Improve some code (using pychecker) Fix dotLinks(): replace print with self.fd.write Remove trailing spaces 2007-10-16 Sebastien Tricaud * gvgen.py: Initial release (0.5)