org.jgrapht.io.DIMACSFormat Maven / Gradle / Ivy
/*
* (C) Copyright 2017-2017, by Dimitrios Michail and Contributors.
*
* JGraphT : a free Java graph-theory library
*
* This program and the accompanying materials are dual-licensed under
* either
*
* (a) the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation, or (at your option) any
* later version.
*
* or (per the licensee's choosing)
*
* (b) the terms of the Eclipse Public License v1.0 as published by
* the Eclipse Foundation.
*/
package org.jgrapht.io;
/**
* DIMACS challenge format.
*
*
* For a general description of the formats see
* http://dimacs.rutgers.edu/Challenges. Note that there are a lot of different formats based on
* each different challenge.
*
* @author Dimitrios Michail
* @since January 2017
*/
public enum DIMACSFormat
{
/**
* Shortest path challenge format.
*
*
* This is the format used in
* the 9th DIMACS implementation challenge.
*
* A shortest path graph file looks as follows:
*
*
* {@code
* c
* p sp
* a
* a
* a
* a
* ...
* }
*
*
* A weighted variant where each edge has a floating-point weight is also supported:
*
*
* {@code
* a
* }
*
*/
SHORTEST_PATH("sp", "a"),
/**
* Max-clique challenge format.
*
*
* This is the format used in
* the 2nd DIMACS implementation challenge.
*
* A graph file looks as follows:
*
*
* {@code
* c
* p edge
* e
* e
* e
* e
* ...
* }
*
*
* A weighted variant where each edge has a floating-point weight is also supported:
*
*
* {@code
* e
* }
*
*/
MAX_CLIQUE("edge", "e"),
/**
* Coloring format.
*
*
* This is the format used in the 2nd
* DIMACS implementation challenge. Same as the {@link DIMACSFormat#MAX_CLIQUE} but uses "col"
* instead of "edge" in the problem definition line.
*/
COLORING("col", "e");
private final String problem;
private final String edge;
private DIMACSFormat(String problem, String edge)
{
this.problem = problem;
this.edge = edge;
}
/**
* Get the name of the problem.
*
* @return the name of the problem.
*/
public String getProblem()
{
return problem;
}
/**
* Get the edge descriptor used in the format.
*
* @return the edge descriptor
*/
public String getEdgeDescriptor()
{
return edge;
}
}