imagepy icon indicating copy to clipboard operation
imagepy copied to clipboard

Bugs in the Network tool

Open CsatiZoltan opened this issue 5 years ago • 5 comments

For the network tool to work with Python 3.7.6, we need some changes:

  • at most networkx package version 2.1. Reason: the node attribute no longer exists as of version 2.4 (see here)
  • correct variable n to n.astype(np.int16) in lines 45, 46 of module graphpen_tol: https://github.com/Image-Py/imagepy/blob/17aa2927bc1216a8956b6a6f8173817cdd9481bb/imagepy/tools/Network/graphpen_tol.py#L45 https://github.com/Image-Py/imagepy/blob/17aa2927bc1216a8956b6a6f8173817cdd9481bb/imagepy/tools/Network/graphpen_tol.py#L46 and similarly in module graphcut_tol: https://github.com/Image-Py/imagepy/blob/17aa2927bc1216a8956b6a6f8173817cdd9481bb/imagepy/tools/Network/graphcut_tol.py#L44 https://github.com/Image-Py/imagepy/blob/17aa2927bc1216a8956b6a6f8173817cdd9481bb/imagepy/tools/Network/graphcut_tol.py#L45 Reason: with numpy version 1.18.1, I get the error message:
    TypeError: 'float' object cannot be interpreted as an integer
    

CsatiZoltan avatar Feb 14 '20 16:02 CsatiZoltan

Remark: the reason why the "Build Graph" tool works in the standalone Windows version is because it uses networkx 2.2. In fact, the previously mentioned issue with the node attribute was deprecated since version 2.2, and was removed in version 2.4.

CsatiZoltan avatar Feb 14 '20 22:02 CsatiZoltan

I just replace all the "node[" by "nodes[", And now every thing is ok for me. I had pushed. have a try?

yxdragon avatar Feb 17 '20 07:02 yxdragon

Yes, that solves the problem, as expected. You need to make the changes in /menus/Analysis/Skeleton Network/graph_plgs.py and in /ipyalg/graph/sknw.py.

The other modification I proposed concerning linspace also works.

CsatiZoltan avatar Feb 17 '20 08:02 CsatiZoltan

Also note that the issue with .node also concerns your sknw repository.

CsatiZoltan avatar Feb 17 '20 08:02 CsatiZoltan

Another error found in graph_plgs.py: connected_component_subgraphs is removed. For a solution, see the related issue https://github.com/rkistner/chinese-postman/issues/21.

CsatiZoltan avatar Feb 17 '20 14:02 CsatiZoltan