Hi
in the function graph_from_adjacency_matrix, in order to define edges, a string
is concatenated with an integer, which generates an error:
Edge( node_prefix + node_orig,
node_prefix + node_dest) )
(node_prefix is a string, node_orig and node_dest are integers).
This is how you can reproduce the problem:
1. define an adjacency matrix:
import numpy as np
am = np.array([[0, 1, 0], [1, 0, 0], [0, 1, 1]])
2. run the function:
import pydot
bdot = pydot.graph_from_adjacency_matrix(am, directed=True)
The expected output is to obtain a bdot object, instead you get:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/pydot.py", line 302, in graph_from_adjacency_matrix
Edge( node_prefix + node_orig,
TypeError: coercing to Unicode: need string or buffer, int found
Similarly, if you run
bdot = pydot.graph_from_adjacency_matrix(np.asarray(a), node_prefix='',
directed=True)
to avoid eventual problems with unicode, you get:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/pydot.py", line 302, in graph_from_adjacency_matrix
Edge( node_prefix + node_orig,
TypeError: cannot concatenate 'str' and 'int' objects
I am using Python 2.7.6, pydot version 1.0.28, on Ubuntu 14.04, 64 bits.
Original issue reported on code.google.com by giampisa...@gmail.com on 26 Jan 2015 at 12:22
Original issue reported on code.google.com by
giampisa...@gmail.com
on 26 Jan 2015 at 12:22