def create_graph(): logger.debug('Creating graph...') graph = gv.graph('xsls') gv.setv(graph, 'charset', 'utf-8') gv.setv(graph, 'rankdir', 'LR') item = gv.protoedge(graph) gv.setv(item, 'minlen', '10') gv.setv(item, 'dir', 'forward') return graph
def __init__(self): self.root = collections.deque() self.root.append([Node(LEAF, 1, 1)]) self.depth = 1 #point to the last inserted self.last = 0 #for draw self.G = gv.digraph("G") gv.setv(self.G, 'nodesep', '0.05') gv.setv(self.G, 'rankdir', 'TB') N = gv.protonode(self.G) gv.setv(N, 'shape', 'record') E = gv.protoedge(self.G) gv.setv(E, 'side', 'left')
def set_style(self): node_style = [('style', 'filled'), ('fillcolor', 'royalblue'), ('penwidth', '0'), ('shape', 'box'), ('width', '.6'), ('height', '.05'), ('fontname', 'Ubuntu'), ('fontsize', '10'), ('fontcolor', 'white')] n = gv.protonode(self.gr) for (a, v) in node_style: gv.setv(n, a, v) edge_style = [('fontname', 'Ubuntu-bold'), ('fontsize', '8'), ('penwidth', '1'), ('color', 'gray73')] e = gv.protoedge(self.gr) for (a, v) in edge_style: gv.setv(e, a, v) graph_style = [('size', '1000,600'), ('ratio', '0.6'), ('epsilon', '0.001'), ('maxiter', '10000')] for (a, v) in graph_style: gv.setv(self.gr, a, v) return
#!/usr/bin/python # display the kernel module dependencies # author: Michael Hohn <*****@*****.**> # based on: modgraph.tcl by John Ellson <*****@*****.**> import sys import gv modules = open("/proc/modules", 'r').readlines() G = gv.digraph("G") N = gv.protonode(G) E = gv.protoedge(G) gv.setv(G, 'rankdir', 'LR') gv.setv(G, 'nodesep', '0.05') gv.setv(N, 'shape', 'box') gv.setv(N, 'width', '0') gv.setv(N, 'height', '0') gv.setv(N, 'margin', '.03') gv.setv(N, 'fontsize', '8') gv.setv(N, 'fontname', 'helvetica') gv.setv(E, 'arrowsize', '.4') for rec in modules: fields = rec.split(' ') n = gv.node(G, fields[0]) for usedby in fields[3].split(','): if (usedby != '-') & (usedby != ''):
#!/usr/bin/env python3 """ display the kernel module dependencies author: Michael Hohn <*****@*****.**> based on: modgraph.tcl by John Ellson <*****@*****.**> """ import gv # pylint: disable=import-error modules = open("/proc/modules", "r").readlines() G = gv.digraph("G") N = gv.protonode(G) E = gv.protoedge(G) gv.setv(G, "rankdir", "LR") gv.setv(G, "nodesep", "0.05") gv.setv(N, "shape", "box") gv.setv(N, "width", "0") gv.setv(N, "height", "0") gv.setv(N, "margin", ".03") gv.setv(N, "fontsize", "8") gv.setv(N, "fontname", "helvetica") gv.setv(E, "arrowsize", ".4") for rec in modules: fields = rec.split(" ") n = gv.node(G, fields[0]) for usedby in fields[3].split(","): if usedby not in ("-", ""):