Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edge lists are incorrectly parsed as adjacency lists #18

Open
PatrickOHara opened this issue Oct 12, 2021 · 0 comments · Fixed by ben-hudson/tsplib95#1 · May be fixed by #19
Open

Edge lists are incorrectly parsed as adjacency lists #18

PatrickOHara opened this issue Oct 12, 2021 · 0 comments · Fixed by ben-hudson/tsplib95#1 · May be fixed by #19

Comments

@PatrickOHara
Copy link

  • TSPLIB 95 version: 0.7.1
  • Python version: 3.8
  • Operating System: Mac OS X

Description

Attempted to parse an edge list by setting EDGE_DATA_FORMAT='EDGE_LIST', but tsplib95 always returns an adjacency instead of an edge list.

What I Did

Added an assert statement to line 23 of test_edge_data_field.py. The test now fails because an edge list is expected for the case on line 13, but an adjacency is returned.

Further when parsing an edge list, each edge is expected to be a tuple, but there is no TupleT transformer for tuples. A list of lists is returned, but a list of tuples is expected.

Proposed fix

  • Create a new TupleT
  • In EdgeDataField, switch the order of edge list and adjacency list. I.e. try to parse edge list first, then if fails, try and parse an adjacency.
  • Add assert statements to tests.
@PatrickOHara PatrickOHara linked a pull request Oct 12, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant