from pygraphviz import AGraph from exim import Exim class Graph: def __init__(self): self.G = AGraph(directed=True) def generate(self, links): for l in links: #self.G.add_node(l[0]) #self.G.add_node(l[1]) self.G.add_edge(l[0], l[1]) self.G.layout() self.G.draw("graph.png", prog='neato') if __name__ == "__main__": feed = Exim("data/mainlog") g = Graph() g.generate(feed.links())