Skip to content

Edge lists are incorrectly parsed as adjacency lists #18

@PatrickOHara

Description

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

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