This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
Graph Representation and Properties
Graphs are first-class citizens in Mathematica, and can be used as input, output, in programs, and in documents. Undirected and directed graphs are treated uniformly and support a number of standard properties for vertices and edges. Importantly, graphs also support custom properties for modeling or computational flexibility. Graphs can be converted to a number of different representations, including matrices. Graphs can be exported with high-fidelity to numerous file formats.
Graph represent a general graph, or create it from vertices and edges
UndirectedEdge an undirected edge (UndirectedEdge)
DirectedEdge a directed edge (DirectedEdge)
GraphQ  ▪ UndirectedGraphQ  ▪ DirectedGraphQ  ▪ EdgeQ  ▪ VertexQ
Basic Properties
VertexCount, EdgeCount the number of vertices and edges in the graph
VertexList, EdgeList the list of vertices and edges in the graph
VertexIndex, EdgeIndex the index for a vertex or edge in a graph
EdgeRules the list of edges as a list of rules
Standard Properties
Property property wrapper for vertices and edges
PropertyValue get and set vertex or edge property values
AdjacencyMatrix vertex-vertex adjacency matrix
Export export graphs into several graph formats
"GraphML"  ▪ "GXL"  ▪ "Graphlet"  ▪ "Pajek"  ▪ "TGF"  ▪ "DOT"  ▪ "DIMACS"  ▪ "Graph6"  ▪ "Sparse6"  ▪ "LEDA"
MORE ABOUT