SOLUTIONS

TGF (.tgf)
TGF graph data format.
Used for the storage and exchange of graphs.
TGF is an acronym for Trivial Graph Format.
Stores directed graphs.
Stores at most one label per vertex and edge.
ASCII format.
Used for the storage and exchange of graphs.
TGF is an acronym for Trivial Graph Format.
Stores directed graphs.
Stores at most one label per vertex and edge.
ASCII format.
Import and ExportImport and Export
 Import["file.tgf"] imports the graph stored in the specified file, given as a single Graph object.
 Export["file.tgf", expr] exports an adjacency matrix or edge information for one graph to the TGF format.
 Import["file.tgf", elem] imports the specified element from a TGF file.
 Import["file.tgf", {elem, sub_{a}, sub_{b}, ...}] imports a subelement.
 Import["file.tgf", {{elem_{1}, elem_{2}, ...}}] imports multiple elements.
 The import format can be specified with Import["file", "TGF"] or Import["file", {"TGF", elem, ...}].
 Export["file.tgf", expr, elem] creates a TGF file by treating expr as specifying element elem.
 Export["file.tgf", {expr_{1}, expr_{2}, ...}, {{elem_{1}, elem_{2}, ...}}] treats each as specifying the corresponding .
 Export["file.tgf", expr, opt_{1}>val_{1}, ...] exports expr with the specified option elements taken to have the specified values.
 Export["file.tgf", {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 TGF 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 "Graph" graph stored in the file, rendered 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 "VertexList" vertices, given as a list of strings  Import by default uses the element when importing from TGF.
OptionsOptions
 General Import options:

ImageSize Automatic specifies the overall size of the image to display for a graph  When importing from a TGF file, 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
ExamplesExamplesopen allclose all
Basic Examples (5)Basic Examples (5)
Import a graph from TGF, giving a visual representation:
In[1]:= 
Out[1]= 
Export a Graph object to the TGF format:
In[1]:= 
Out[1]= 
Export a list of edge rules representing a directed graph to TGF:
In[1]:= 
Out[1]= 
Export an asymmetric adjacency matrix to TGF:
In[1]:= 
Out[1]= 
Render an adjacency matrix representation of a TGF graph as a MatrixPlot:
In[1]:= 
Out[1]= 
Export a list of edge rules and attributes to TGF:
In[1]:= 
Out[1]= 
Export an adjacency matrix together with vertex labels and attributes:
In[1]:= 
Out[1]= 
New in 8
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »