ipython-d3networkx icon indicating copy to clipboard operation
ipython-d3networkx copied to clipboard

Too many nodes!

Open mattharrison opened this issue 10 years ago • 0 comments

I'm trying to plot a simple graph with a node and a child. Sometimes it renders 3 nodes (2 of them connected). Other times it renders nothing. What am I doing wrong?

eg2 = EventfulGraph()
d32 = ForceDirectedGraph(eg2)

d32.width = 300
d32.height = 300

edges = set()
for name, rid, pid in [('root', 1, None),
                       ('c1', 2, 1)]:
    eg2.add_node(rid, label=name, 
                 fill='red', 
                 stroke="black", color='black',
                 font_size='8px', r=5)
    if pid: 
        edges = edges | {(rid, pid)}
for i1, i2 in edges:
    eg2.add_edge(int(i1), int(i2),
                 distance=50)
display(d32)

mattharrison avatar Jun 02 '15 22:06 mattharrison