dafsa
dafsa copied to clipboard
condense() throws "IndexError: list index out of range"
Hi there,
I am dabbling with implementing my own DAFSA at the moment, and wondered how a particular sceneario would be represented in an already established library, and got an error. Seeing that this repo is still active and also the one people will most likely find when looking for a DAFSA implementation in python, I did not want to leave without a bug report. Thank you for sharing your work! :)
Reproduction
from dafsa import DAFSA
dafsa = DAFSA(["tapas", "topos"])
# dafsa.condense() # commenting in will cause an error
dafsa.write_figure("test.dot")
What did I expect to happen
A graph of the condensed graph, in particular I assumed that there would only be one edge for 'p' now. (OR: two new collapsed edges, 'apa' and 'opo' - to be honest, I am still a bit shaky when it comes to terminology of DAFSAs/DAWGs)
What happened instead
This error was thrown:
Traceback (most recent call last):
File "/home/me/bidafsa-visualizer/graphy.py", line 5, in <module>
dafsa.condense() # commenting in will cause an error
File "/home/me/.local/lib/python3.10/site-packages/dafsa/dafsa.py", line 610, in condense
if self._joining_round() == 0:
File "/home/me/.local/lib/python3.10/site-packages/dafsa/dafsa.py", line 655, in _joining_round
edge_info = [edge for edge in edges if edge["target"] == node_id][0]
IndexError: list index out of range
Setup
- OS: Ubuntu 22.04.3 LTS (WSL2)
- Python version: Python 3.10.12
- Library version:
dafsa==1.0(got viapip freeze)