python - Pydot - store nodes in list - unhashable type: 'list' error -


i'm using pydot generate graph list of strings

graph = pydot.dot(graph_type='digraph') node_list = [] in xrange(0, len(string_list)):     node_list.append(pydot.node(string_list[i]))     graph.add_node(node_list[-1])     j in (0,len(string_list)):         graph.add_edge(pydot.edge(node_list[i], node_list[j], label=matrix[i,j])) 

but following error in add_node line:

typeerror: unhashable type: 'list' 

how can solve this?

you have list in string_list, error can reproduced with:

graph = pydot.dot(graph_type='digraph')  node_a = pydot.node(["node a"])  graph.add_node(node_a) 

Comments