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

Should each list in adjacency lists be terminated by -1? #20

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

Should each list in adjacency lists be terminated by -1? #20

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

In test_adjacency_list_fields.py, the end of each list is terminated by -1:

    return '\n'.join([
        '0 1 2 3 -1',
        '1 0 2 3 -1',
        '2 0 1 3 -1',
        '3 0 1 2 -1',
        '-1',
    ])

But in test_edge_data_field.py there is only \n separating each adj list.

Which is correct?

Terminating each list with a -1 means an adjacency cannot be accidently interpreted as an edge list, removing any ambiguity. This seems cleaner?

@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