Class TSPLIBImporter.Metadata<V,E>

java.lang.Object
org.jgrapht.nio.tsplib.TSPLIBImporter.Metadata<V,E>
Type Parameters:
V - the graph vertex type
E - the graph edge type
Enclosing class:
TSPLIBImporter<V,E>

public static class TSPLIBImporter.Metadata<V,E> extends Object
Container for the meta data of an imported TSPLIB95 file.
Author:
Hannes Wellmann
  • Method Details

    • getSpecification

      public TSPLIBImporter.Specification getSpecification()
      Returns the TSPLIBImporter.Specification instance containing all values from the specification part of a TSPLIB95 file.
      Returns:
      the Specification of an imported TSPLIB95 file
    • getVertexToNodeMapping

      public Map<V,TSPLIBImporter.Node> getVertexToNodeMapping()
      Returns the mapping of vertex to corresponding node imported from the NODE_COORD_SECTION of a TSPLIB95 file.
      Returns:
      the mapping of vertex to corresponding node
    • getTour

      public List<V> getTour()
      Returns the List of vertices in the order of the tour defined in an imported TSPLIB95 file or null if no tour was imported.

      Note that a tour can be imported by TSPLIBImporter.importGraph(Graph, Reader) or TSPLIBImporter.importTour(Metadata, Reader) .

      Returns:
      the vertex tour from the file or null
    • hasDistinctNodeLocations

      public boolean hasDistinctNodeLocations()
      Returns true if for the imported graph all vertices have distinct coordinates and non of them have equal coordinate values , else false.
      Returns:
      true if no equally located nodes were imported from the file, else false
      Throws:
      IllegalStateException - if no graph was imported
    • hasDistinctNeighborDistances

      public boolean hasDistinctNeighborDistances()
      Returns true if for the imported graph each vertex all touching edges have different weights.

      If this method returns true this means for the TSP that for each location each other location has a different distance, so there are no two other locations that have the same distance from that location.

      Returns:
      true if all touching edges of each vertex have different weight, else false
      Throws:
      IllegalStateException - if no graph was imported