Preventing a graph from overlapping nodes and edges.

196 views
Skip to first unread message

Bill Sempf

unread,
Nov 26, 2015, 11:46:56 PM11/26/15
to pygraphviz-discuss
This must be ABSURDLY simple, because I have seen no other posts about it anywhere.

I have the question on Stack Overflow, you can find it here:


For futures, here is the test of the question:

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.



Reply all
Reply to author
Forward
0 new messages