Dan
On May 26, 2010, at 6:16 PM, dowstreet wrote:
> Hi. I'm getting this error when I try to draw a graph using a
> position library:
>
> networkx.exception.NetworkXError: Node 'n12' has no position.
>
> Here's the log:
>
>>>> networkx.draw(G,pos)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/networkx-1.0.1-py2.5.egg/networkx/drawing/
> nx_pylab.py", line 126, in draw
> File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/networkx-1.0.1-py2.5.egg/networkx/drawing/
> nx_pylab.py", line 169, in draw_networkx
> File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/networkx-1.0.1-py2.5.egg/networkx/drawing/
> nx_pylab.py", line 221, in draw_networkx_nodes
> networkx.exception.NetworkXError: Node 'n12' has no position.
>>>> pos
> {0: (1, 10), 1: (0, 9), 2: (1, 9), 3: (2, 9), 4: (0, 2), 5: (0, 1), 6:
> (1, 2), 7: (1, 1), 8: (2, 2), 9: (2, 1), 10: (3, 7), 11: (3, 4), 12:
> (4, 6), 13: (4, 10), 14: (6, 10), 15: (9, 10), 16: (8, 9), 17: (10,
> 9), 18: (5, 8), 19: (6, 7), 20: (3, 1), 21: (4, 2), 22: (4, 1), 23:
> (5, 2), 24: (5, 3), 25: (6, 3), 26: (7, 2), 27: (8, 3), 28: (9, 2),
> 29: (10, 1), 30: (8, 1), 31: (7, 0), 32: (6, 0), 33: (10, 4), 34: (10,
> 5), 35: (11, 5), 36: (11, 4), 37: (11, 2), 38: (11, 10)}
>
>
> If I add a node list, the graph is actually drawn, but I still have an
> error returned:
>
>>>> networkx.draw(G,pos, nodelist=
>>>> [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,2
>>>> 5,26,27,28,29,30,32,32,33,34,35,36,37,38])
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/networkx-1.0.1-py2.5.egg/networkx/drawing/
> nx_pylab.py", line 126, in draw
> File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/networkx-1.0.1-py2.5.egg/networkx/drawing/
> nx_pylab.py", line 170, in draw_networkx
> File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/networkx-1.0.1-py2.5.egg/networkx/drawing/
> nx_pylab.py", line 302, in draw_networkx_edges
> KeyError: 'n12'
>
>
> Any thoughts?
>
> Thanks,
> Dow
>
> --
> You received this message because you are subscribed to the Google
> Groups "networkx-discuss" group.
> To post to this group, send email to networkx-
> dis...@googlegroups.com.
> To unsubscribe from this group, send email to networkx-discuss
> +unsub...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/
> group/networkx-discuss?hl=en.
>
>>> print G.nodes()
['n12', 'n13', 'n10', 'n11', 'n16', 'n17', 'n14', 'n15', 'n18', 'n19',
'n38', 'n39', 'n30', 'n31', 'n32', 'n33', 'n34', 'n35', 'n36', 'n37',
'n29', 'n28', 'n23', 'n22', 'n21', 'n20', 'n27', 'n26', 'n25', 'n24',
'n8', 'n9', 'n0', 'n1', 'n2', 'n3', 'n4', 'n5', 'n6', 'n7']
n12 is first!
Anyway, thanks again.
R,
Dow
>> To post to this group, send email to networkx...@googlegroups.com
>> .
>> To unsubscribe from this group, send email to networkx-discu...@googlegroups.com
>> .
>> For more options, visit this group at http://groups.google.com/group/networkx-discuss?hl=en
>> .
>>
>
> --
> You received this message because you are subscribed to the Google
> Groups "networkx-discuss" group.
> To post to this group, send email to networkx-
> dis...@googlegroups.com.
> To unsubscribe from this group, send email to networkx-discu...@googlegroups.com