java.lang.Object
org.jgrapht.nio.tsplib.TSPLIBImporter.Metadata<V,E>
- Type Parameters:
V
- the graph vertex typeE
- the graph edge type
- Enclosing class:
- TSPLIBImporter<V,
E>
Container for the meta data of an imported TSPLIB95 file.
- Author:
- Hannes Wellmann
-
Method Summary
Modifier and TypeMethodDescriptionReturns theTSPLIBImporter.Specification
instance containing all values from the specification part of a TSPLIB95 file.getTour()
Returns theList
of vertices in the order of the tour defined in an imported TSPLIB95 file or null if no tour was imported.Returns the mapping of vertex to corresponding node imported from the NODE_COORD_SECTION of a TSPLIB95 file.boolean
Returns true if for the imported graph each vertex all touching edges have different weights.boolean
Returns true if for the imported graph all vertices have distinct coordinates and non of them haveequal
coordinate values
, else false.
-
Method Details
-
getSpecification
Returns theTSPLIBImporter.Specification
instance containing all values from the specification part of a TSPLIB95 file.- Returns:
- the
Specification
of an imported TSPLIB95 file
-
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
Returns theList
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)
orTSPLIBImporter.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 haveequal
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
-