def process_templates_noComp(templates, rdfTemplates): gTemplates = [ ] for template in templates: tname = prettyName(template) templatesDAG = tdag(tname) # Beginning of template is special case--then we can process them by tree genericT = conflate(template,rdfTemplates) prettyT = prettyName(genericT) templatesDAG.add_node(prettyT,template) despecifiedTemplate = process_template_noComp(template,prettyT,rdfTemplates,templatesDAG) gTemplates.append(despecifiedTemplate) return gTemplates
from pygraph.classes.digraph import digraph from pygraph.readwrite.markup import write import pydot import tdag from tdag import draw_graphs pcgweighted = tdag.tdag("example-pcgweighted") pcglabels = tdag.tdag("example-pcglabels") g1 = tdag.tdag("example-g1") g2 = tdag.tdag("example-g2") try: pcgweighted.add_node("stable1/unstable2", "") except: pass try: pcgweighted.add_node("component1/component3", "") except: pass try: pcgweighted.add_edge(("stable1/unstable2", "component1/component3"), label=" 1") except: pass try: pcgweighted.add_node("inelastic1/elastic2", "") except: pass try: pcgweighted.add_node("component1/component4", "") except: pass try: pcgweighted.add_edge(("inelastic1/elastic2", "component1/component4"), label=" 1") except: pass try: pcgweighted.add_node("open2/open3", "") except: pass try: pcgweighted.add_node("component2/component4", "") except: pass
from pygraph.classes.digraph import digraph from pygraph.readwrite.markup import write import pydot import tdag from tdag import draw_graphs pcg = tdag.tdag("pcg") pcgnolabels = tdag.tdag("pcgnolabels") g1 = tdag.tdag("g1") g2 = tdag.tdag("g2") try: pcg.add_node("stable1/unstable2", "") except: pass try: pcg.add_node("component1/component3", "") except: pass try: pcg.add_edge(("stable1/unstable2", "component1/component3"), label=" 1") except: pass try: pcg.add_node("inelastic1/elastic2", "") except: pass try: pcg.add_node("component1/component4", "") except: pass try: pcg.add_edge(("inelastic1/elastic2", "component1/component4"), label=" 1") except: pass try: pcg.add_node("open2/open3", "") except: pass try: pcg.add_node("component2/component4", "") except: pass