org.jgrapht.nio.dimacs.DIMACSFormat Maven / Gradle / Ivy
/*
* (C) Copyright 2017-2023, by Dimitrios Michail and Contributors.
*
* JGraphT : a free Java graph-theory library
*
* See the CONTRIBUTORS.md file distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the
* GNU Lesser General Public License v2.1 or later
* which is available at
* http://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html.
*
* SPDX-License-Identifier: EPL-2.0 OR LGPL-2.1-or-later
*/
package org.jgrapht.nio.dimacs;
/**
* 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
*/
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;
}
}