d-michail / python-jgrapht

The Python-JGraphT library
Eclipse Public License 2.0
22 stars 7 forks source link

Can't draw Graph with any_hashable = True, what should i do? #14

Open Sjunhao opened 2 years ago

Sjunhao commented 2 years ago

Here have some info ` Traceback (most recent call last):

File "_ctypes/callbacks.c", line 234, in 'calling callback function'

File "F:\python36\lib\site-packages\jgrapht\algorithms\drawing.py", line 67, in actual_vertex_comparator_cb return vertex_comparator_cb(v1, v2)

TypeError: 'NoneType' object is not callable

Traceback (most recent call last):

File "_ctypes/callbacks.c", line 234, in 'calling callback function'

File "F:\python36\lib\site-packages\jgrapht\algorithms\drawing.py", line 67, in actual_vertex_comparator_cb

return vertex_comparator_cb(v1, v2)

TypeError: 'NoneType' object is not callable

Traceback (most recent call last):

File "_ctypes/callbacks.c", line 234, in 'calling callback function'

File "F:\python36\lib\site-packages\jgrapht\algorithms\drawing.py", line 67, in actual_vertex_comparator_cb

return vertex_comparator_cb(v1, v2)

TypeError: 'NoneType' object is not callable

Traceback (most recent call last):

File "_ctypes/callbacks.c", line 234, in 'calling callback function'

File "F:\python36\lib\site-packages\jgrapht\algorithms\drawing.py", line 67, in actual_vertex_comparator_cb

return vertex_comparator_cb(v1, v2)

TypeError: 'NoneType' object is not callable

Traceback (most recent call last):

File "_ctypes/callbacks.c", line 234, in 'calling callback function'

File "F:\python36\lib\site-packages\jgrapht\algorithms\drawing.py", line 67, in actual_vertex_comparator_cb

return vertex_comparator_cb(v1, v2)

TypeError: 'NoneType' object is not callable

Traceback (most recent call last):

File "_ctypes/callbacks.c", line 234, in 'calling callback function'

File "F:\python36\lib\site-packages\jgrapht\algorithms\drawing.py", line 67, in actual_vertex_comparator_cb

return vertex_comparator_cb(v1, v2)

TypeError: 'NoneType' object is not callable

Traceback (most recent call last):

File "_ctypes/callbacks.c", line 234, in 'calling callback function'

File "F:\python36\lib\site-packages\jgrapht\algorithms\drawing.py", line 67, in actual_vertex_comparator_cb

return vertex_comparator_cb(v1, v2)

TypeError: 'NoneType' object is not callable

Traceback (most recent call last):

File "_ctypes/callbacks.c", line 234, in 'calling callback function'

File "F:\python36\lib\site-packages\jgrapht\algorithms\drawing.py", line 67, in actual_vertex_comparator_cb

return vertex_comparator_cb(v1, v2)

TypeError: 'NoneType' object is not callable

Traceback (most recent call last):

File "_ctypes/callbacks.c", line 234, in 'calling callback function'

File "F:\python36\lib\site-packages\jgrapht\algorithms\drawing.py", line 67, in actual_vertex_comparator_cb

return vertex_comparator_cb(v1, v2)

TypeError: 'NoneType' object is not callable

Traceback (most recent call last):

File "_ctypes/callbacks.c", line 234, in 'calling callback function'

File "F:\python36\lib\site-packages\jgrapht\algorithms\drawing.py", line 67, in actual_vertex_comparator_cb

return vertex_comparator_cb(v1, v2)

TypeError: 'NoneType' object is not callable

Traceback (most recent call last):

File "_ctypes/callbacks.c", line 234, in 'calling callback function'

File "F:\python36\lib\site-packages\jgrapht\algorithms\drawing.py", line 67, in actual_vertex_comparator_cb

return vertex_comparator_cb(v1, v2)

TypeError: 'NoneType' object is not callable

Traceback (most recent call last):

...

Graph.drawing.draw_matplotlib.draw_jgrapht(G)

File "F:\python36\lib\site-packages\jgrapht\drawing\draw_matplotlib.py", line 119, in draw_jgrapht

positions = layout(g, name=kwargs.get('name'))

File "F:\python36\lib\site-packages\jgrapht\drawing\draw_matplotlib.py", line 770, in layout

x, y = result.get_vertex_location(i)

File "F:\python36\lib\site-packages\jgrapht_internals_anyhashableg_drawing.py", line 18, in get_vertex_location

vertex = _vertex_anyhashableg_to_g(self._graph, vertex)

File "F:\python36\lib\site-packages\jgrapht_internals_anyhashableg.py", line 797, in _vertex_anyhashableg_to_g

return graph._vertex_hash_to_id[vertex] if vertex is not None else None

KeyError: 0

`

The Graph vertex is a new class. it can work, but can't drawing.

Sjunhao commented 2 years ago

hello,i found line 770 in draw_matplotlip.py change ” x, y = result.get_vertex_location(i)“ to ”x, y = result.get_vertex_location(vertex)“ .it will get a new ERROR but can right work. This may help someone。

Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 234, in 'calling callback function'
  File "F:\python36\lib\site-packages\jgrapht\algorithms\drawing.py", line 67, in actual_vertex_comparator_cb
    return vertex_comparator_cb(v1, v2)
TypeError: 'NoneType' object is not callable