SOLUTIONS

MATHEMATICA IMPORT/EXPORT FORMAT
Pajek (.net)
Pajek graph language and data format.
Commonly used exchange format for graphs.
Native format of the Pajek network analysis software.
The format name is Slovenian for spider.
Stores a single directed, undirected, or mixed graph.
Can contain userdefined edge and vertex attributes.
Plain text format.
Developed in 1996 by researchers at Ljubljana University.
Commonly used exchange format for graphs.
Native format of the Pajek network analysis software.
The format name is Slovenian for spider.
Stores a single directed, undirected, or mixed graph.
Can contain userdefined edge and vertex attributes.
Plain text format.
Developed in 1996 by researchers at Ljubljana University.
Import and ExportImport and Export
 Import["file.net"] gives a Graph object representing the graph stored in the specified file.
 Export["file.net", expr] exports an adjacency matrix or edge information representing a graph to the Pajek format.
 Import["file.net"] imports the graph from file and returns it as a Graph.
 Import["file.net", elem] imports the specified element from a Pajek file.
 Import["file.net", {{elem_{1}, elem_{2}, ...}}] imports multiple elements.
 The import format can be specified with Import["file", "Pajek"] or Import["file", {"Pajek", elem, ...}].
 Export["file.net", expr, elem] creates a Pajek file by treating expr as specifying element elem.
 Export["file.net", {expr_{1}, expr_{2}, ...}, {{elem_{1}, elem_{2}, ...}}] treats each as specifying the corresponding .
 Export["file.net", expr, opt_{1}>val_{1}, ...] exports expr with the specified option elements taken to have the specified values.
 Export["file.net", {elem_{1}>expr_{1}, elem_{2}>expr_{2}, ...}, "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 Pajek 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 "EdgeAttributes" edge attributes, represented as a list of rules "EdgeRules" connectivity data for the graph, given as a list of rules "EdgeRulesDirected" directed edges "EdgeRulesUndirected" undirected edges "Graph" graph stored in the file, given as a Graph object "Graphics" graph stored in the file, rendered as a graph plot "VertexAttributes" vertex attributes, represented as a list of rules "VertexCount" number of vertices in the graph  Import by default uses the element when importing from Pajek.
OptionsOptions
 General Import options:

ImageSize Automatic specifies the overall size of the image to display for a graph  When importing from Pajek, 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 , 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  Export options:

DirectedEdges Automatic whether the data to be exported represents a directed graph VertexCoordinates Automatic rules for explicit vertex coordinates  When exporting from edge rules or from a symmetric adjacency matrix, edges are taken to be undirected by default.
ExamplesExamplesopen allclose all
Basic Examples (6)Basic Examples (6)
Import a Graph object from a Pajek file:
In[1]:= 
Out[1]= 
Show the Import elements available from an example file:
In[1]:= 
Out[1]= 
Import the connectivity rules of a graph:
In[1]:= 
Out[1]= 
Export a Graph to the Pajek format:
In[1]:= 
Out[1]= 
Export an asymmetric adjacency matrix of a graph to the Pajek format:
In[1]:= 
Out[1]= 
Convert a list of edge rules representing an undirected graph to the Pajek language:
In[1]:= 
Out[1]= 
New in 8
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »