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

GXL (.gxl)

GXL graph data format.
Used for the storage and exchange of graphs.
GXL is an acronym derived from Graph Exchange Language.
XML-based format.
Represents typed, attributed, directed, and undirected graphs.
Can also store nested graphs and hypergraphs.
Supports user-defined edge and vertex types.
Developed in 2000 by a group of research organizations.
  • Import imports the graphs stored in the specified file, given as a single Graph object or a list of graphs.
  • Export exports an adjacency matrix or edge information for one graph or for multiple graphs to the GXL format.
  • Import imports the specified element from a GXL file.
  • Import imports multiple elements.
  • Export creates a GXL 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 list of matrices
"EdgeAttributes"edge attributes, represented as a list of rules
"EdgeLabels"list of strings representing edge labels
"EdgeRules"connectivity data for all graphs, given as an array of rules
"EdgeTypes"edge types, given as a list of strings
"Graph"first graph stored in the file, given as a Graph object
"Graphics"first graph stored in the file, rendered as a graph plot
"GraphicsList"all graphs given as a list of graphics objects
"GraphList"all graphs given as a list of Graph objects
"VertexAttributes"vertex attributes, represented as a list of rules
"VertexCount"number of vertices in each graph, given as a list of integers
"VertexList"vertices, given as a list of strings
"VertexTypes"vertex types, given as a list of strings
  • Import by default uses for simple GXL files and for multi-graph GXL files.
  • Element specifications for GXL files containing multiple graphs:
"GraphNames"names of the graphs, given as a list of strings
elem,"name"element elem for the graph specified by
elem,ndata representation element elem for the n^(th) graph in this file
elem,{n1,n2,...}element elem for graphs , , ...
elem,Allelement elem for all graphs, given as a list
ImageSizeAutomaticspecify the overall size of the image to display for a graph
DirectedEdgesAutomaticwhether the data to be exported represents a directed graph
  • When exporting from edge rules or from a symmetric adjacency matrix, edges are taken to be undirected by default.
  • When importing from GXL, 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 , 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
  • When exporting from a Graph object, Mathematica graph attribute values are often exported as strings using Compress.
Import a directed graph from GXL:
Show the Import elements available in this file:
Import an edge and vertex list and the connectivity rules from this file:
Import edge and vertex attributes:
Import an undirected graph, rendered as a graph plot:
Import the adjacency matrix for this graph:
Export a Graph object to GXL:
Export edge rules to GXL:
Export an adjacency matrix to GXL:
Import and plot a graph, displaying vertex labels:
Export a directed graph:
Export an adjacency matrix to GXL:
Import a directed graph from GXL:
In[1]:=
Click for copyable input
Out[1]=
 
Show the Import elements available in this file:
In[1]:=
Click for copyable input
Out[1]=
 
Import an edge and vertex list and the connectivity rules from this file:
In[1]:=
Click for copyable input
Out[1]=
 
Import edge and vertex attributes:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
 
Import an undirected graph, rendered as a graph plot:
In[1]:=
Click for copyable input
Out[1]=
 
Import the adjacency matrix for this graph:
In[1]:=
Click for copyable input
Out[1]//TableForm=
 
Export a Graph object to GXL:
In[1]:=
Click for copyable input
Out[1]=
 
Export edge rules to GXL:
In[1]:=
Click for copyable input
Out[1]=
 
Export an adjacency matrix to GXL:
In[1]:=
Click for copyable input
Out[1]=
Import and plot a graph, displaying vertex labels:
In[1]:=
Click for copyable input
Out[1]=
 
Export a directed graph:
In[1]:=
Click for copyable input
Out[1]=
 
Export an adjacency matrix to GXL:
In[1]:=
Click for copyable input
Out[1]=