I am reading a JSON file and dynamically creating a graph using pygraphviz, using a simple loop:
hostdata = []
nodes = []
edges = {}
current_host = ""
trial = pgv.AGraph(strict=False, overlap=False)
for filename in os.listdir(options.directory):
with open(options.directory + "/" + filename, "r") as myfile:
hostdata = Truth(myfile.read().replace('\n', ''))
nodes.append(hostdata.host["something"])
current_something = hostdata.host["something"]
for key, value in hostdata.peer.iteritems():
nodes.append(key)
edges[current_something] = key
trial.add_edge(current_host, key)
The graph is complicated, but I really would prefer if the edges don't cross the nodes. I tried, when I set the strict and overlap, but I still have lines crossing over nodes.
This seems like something people would run into a lot, but I can't find anything on it. I am probably doing something completely wrong, or using the wrong search term. Any help appreciated.