networkx fails to reach an end node
Closed this issue · 3 comments
NB: This issue refers to bertsky/ocrd_keraslm state 87015de, but there is no possibility to open an issue there and the code is already supposed to be used by cor-asv-fst
.
The attached test script fails (error message below), although a path from node 0 to 8 clearly exists in the input graph (e.g. 0 -> 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> 7 -> 8).
$ python3 test-keraslm.py
Using TensorFlow backend.
2019-07-02 16:55:47.105686: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
16:55:47.112 INFO ocrd_keraslm.lib.rating - using CPU LSTM implementation to compile stateless incremental model of depth 2 width 512 length 512 size 362
Traceback (most recent call last):
File "test-keraslm.py", line 112, in <module>
beam_clustering_dist = 5)
File "/home/msumalvico/venv/ocrd/lib/python3.5/site-packages/ocrd_keraslm-0.3.1-py3.5.egg/ocrd_keraslm/lib/rating.py", line 823, in rate_best
AssertionError: breadth-first search failed to reach true end node (7 instead of 8)
Versions:
python 3.5.3 (from debian-stable)
networkx 2.3
(change the path in line 5 of the script to the path of the attached model file)
Confirmed. I can reproduce now. Does not affect Python 3.4 or Python 3.6 – only Python 3.5! I will investigate further.
I think this is an error (at least in documentation) on the side of networkx. I have opened an issue and PR there.
Regardless, I have circumvented the issue by fixing the traversal routine altogether locally. See final commit on above mentioned PR.
@maciejjan thanks for bringing this up!