def drawGraph(self): sys.stderr.write("Drawing graph\n") seenBefore = set() dot = Digraph(comment="Graph") for app in self.apps: simp = app if simp not in seenBefore: dot.node(simp, simp) seenBefore.add(simp) for source in self.sources: simp = self.hashToObjectMapping[source].method if simp not in seenBefore: dot.node(simp, simp) seenBefore.add(simp) for sink in self.sinks: simp = self.hashToObjectMapping[sink].method if simp not in seenBefore: dot.node(simp, simp) seenBefore.add(simp) for (start,end) in self.edges: intentHashSet=self.edges[start,end] #esimp = str(self.hashToObjectMapping[intentHash]) #dot.node(esimp, esimp) #seenBefore.add(esimp) intentNames=set() for intentHash in intentHashSet: if (intentHash in self.hashToObjectMapping): obj=self.hashToObjectMapping[intentHash] if isinstance(obj, Source): intentNames.add(obj.method) elif isinstance(obj, Sink): intentNames.add(obj.method) elif isinstance(obj, Intent): intentNames.add(obj.intentDefinition.__str__()) else: intentNames.add("?") else: intentNames.add("?") try: #dot.edge(simp,esimp, label= ",".join(self.edges[key,e])) #dot.edge(start,end, label= "Intents: {}".format(",".join(intentNames))) dot.body.append(dot.quote(start) + " -> " + dot.quote(end) + " [label=" + dot.quote("Intents: {}".format(",".join(intentNames))) + "]" + "\n") except: pass dot.render("graph-test.gv", view=False)