Skip to content

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

@PatrickOHara

Description

@PatrickOHara
  • 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions