- 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>
public static class TSPLIBImporter.Metadata<V,E> extends java.lang.Object
Container for the meta data of an imported TSPLIB95 file.- Author:
- Hannes Wellmann
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TSPLIBImporter.Specification
getSpecification()
Returns theTSPLIBImporter.Specification
instance containing all values from the specification part of a TSPLIB95 file.java.util.List<V>
getTour()
Returns theList
of vertices in the order of the tour defined in an imported TSPLIB95 file or null if no tour was imported.java.util.Map<V,TSPLIBImporter.Node>
getVertexToNodeMapping()
Returns the mapping of vertex to corresponding node imported from the NODE_COORD_SECTION of a TSPLIB95 file.boolean
hasDistinctNeighborDistances()
Returns true if for the imported graph each vertex all touching edges have different weights.boolean
hasDistinctNodeLocations()
Returns true if for the imported graph all vertices have distinct coordinates and non of them haveequal
coordinate values
, else false.
-
-
-
Method Detail
-
getSpecification
public TSPLIBImporter.Specification 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
public java.util.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 java.util.List<V> 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:
java.lang.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:
java.lang.IllegalStateException
- if no graph was imported
-
-