|
SOLUTIONS
|
MATHEMATICA IMPORT/EXPORT FORMAT
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.
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 and ExportImport and Export
- Import["file.col"] gives a Graph object representing the graph stored in the specified file.
- Export["file.col", expr] exports an adjacency matrix or edge information representing a graph to the DIMACS format.
- Import["file.col"] imports the graph from file and returns it as a Graph.
- Import["file.col", elem] imports the specified element from a DIMACS file.
- Import["file.col", {{elem1, elem2, ...}}] imports multiple elements.
- The import format can be specified with Import["file", "DIMACS"] or Import["file", {"DIMACS", elem, ...}].
- Export["file.col", expr, elem] creates a DIMACS file by treating expr as specifying element elem.
- Export["file.col", {expr1, expr2, ...}, {{elem1, elem2, ...}}] treats each
as specifying the corresponding
. - Export["file.col", expr, opt1->val1, ...] exports expr with the specified option elements taken to have the specified values.
- Export["file.col", {elem1->expr1, elem2->expr2, ...}, "Rules"] uses rules to specify the elements to be exported.
- See the reference pages for full general information on Import and Export.
- ImportString and ExportString support the DIMACS file format.
ElementsElements
- General Import elements:
-
"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.
OptionsOptions
- General Import options:
-
ImageSize Automatic specifies the overall size of the image to display for a graph - Export option:
-
BinaryFormat False whether to create a binary DIMACS file - When importing from DIMACS, all options supported by Graph can be given. Common settings include:
-
EdgeLabels Automatic labels and label placement for edge EdgeWeight Automatic weight for edge VertexCoordinates Automatic center coordinate for vertex VertexLabels Automatic labels and label placement for vertex VertexShape Automatic graphic shape for vertex - When importing as
, all options supported by GraphPlot can be given. Common settings include: -
DirectedEdges Automatic whether to show edges as directed arrows EdgeLabeling Automatic whether to include labels given for edges EdgeRenderingFunction Automatic function to give explicit graphics for edges VertexLabeling Automatic whether to show vertex names as labels VertexRenderingFunction Automatic function to give explicit graphics for vertices
ExamplesExamplesopen allclose all
Basic Examples (7)Basic Examples (7)
Import a Graph object from a DIMACS file:
| In[1]:= |
| Out[1]= | ![]() |
| In[1]:= |
| Out[1]= |
| In[1]:= |
Out[1]//MatrixForm= | |
![]() | |
Get a list of all available Import elements:
| In[1]:= |
| Out[1]= |
Export a Graph to a DIMACS file:
| In[1]:= |
| Out[1]= |
Export an adjacency matrix to the DIMACS format:
| In[1]:= |
| Out[1]= | ![]() |
Export edge rules to a binary DIMACS file:
| In[1]:= |
| Out[1]= |
New in 8
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »



