This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

DIMACS (.col, .col.b)

DIMACS graph data format.
Commonly used exchange format for graphs.
Stores a single undirected graph.
Plain text or binary format.
DIMACS is an acronym derived from Discrete Mathematics and Theoretical Computer Science.
Developed in 1993 at Rutgers University.
  • Import gives a Graph object representing the graph stored in the specified file.
  • Export exports an adjacency matrix or edge information representing a graph to the DIMACS format.
  • Import imports the graph from file and returns it as a Graph.
  • Import imports the specified element from a DIMACS file.
  • Import imports multiple elements.
  • Export creates a DIMACS file by treating expr as specifying element elem.
  • Export treats each as specifying the corresponding .
  • Export exports expr with the specified option elements taken to have the specified values.
  • Export uses rules to specify the elements to be exported.
  • See the reference pages for full general information on Import and Export.
"Elements"list of elements and options available in this file
"Rules"full list of rules for each element and option
"Options"list of rules for options, properties, and settings
  • Data representation elements:
"AdjacencyMatrix"edge information, given as a matrix
"EdgeRules"connectivity data for the graph, given as a list of rules
"Graph"graph stored in the file, given as a Graph object
"Graphics"graph stored in the file, rendered as a graph plot
"VertexCount"number of vertices in the graph
  • Import by default uses the element when importing from DIMACS.
ImageSizeAutomaticspecifies the overall size of the image to display for a graph
BinaryFormatFalsewhether to create a binary DIMACS file
  • When importing from DIMACS, all options supported by Graph can be given. Common settings include:
EdgeLabelsAutomaticlabels and label placement for edge
EdgeWeightAutomaticweight for edge
VertexCoordinatesAutomaticcenter coordinate for vertex
VertexLabelsAutomaticlabels and label placement for vertex
VertexShapeAutomaticgraphic shape for vertex
  • When importing as , all options supported by GraphPlot can be given. Common settings include:
DirectedEdgesAutomaticwhether to show edges as directed arrows
EdgeLabelingAutomaticwhether to include labels given for edges
EdgeRenderingFunctionAutomaticfunction to give explicit graphics for edges
VertexLabelingAutomaticwhether to show vertex names as labels
VertexRenderingFunctionAutomaticfunction to give explicit graphics for vertices
Import a Graph object from a DIMACS file:
Import edge rules:
Import the adjacency matrix:
Get a list of all available Import elements:
Export a Graph to a DIMACS file:
Export an adjacency matrix to the DIMACS format:
Export edge rules to a binary DIMACS file:
Import a Graph object from a DIMACS file:
In[1]:=
Click for copyable input
Out[1]=
 
Import edge rules:
In[1]:=
Click for copyable input
Out[1]=
 
Import the adjacency matrix:
In[1]:=
Click for copyable input
Out[1]//MatrixForm=
 
Get a list of all available Import elements:
In[1]:=
Click for copyable input
Out[1]=
 
Export a Graph to a DIMACS file:
In[1]:=
Click for copyable input
Out[1]=
 
Export an adjacency matrix to the DIMACS format:
In[1]:=
Click for copyable input
Out[1]=
 
Export edge rules to a binary DIMACS file:
In[1]:=
Click for copyable input
Out[1]=