This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
Graphs & Networks
Graphs and networks are all around us including technological networks (the internet, power grids, telephone networks, transportation networks, ...), social networks (social graphs, affiliation networks, ...), information networks (world wide web, citation graphs, patent networks, ...), biological networks (biochemical networks, neural networks, food webs, ...) and many more. Graphs provide a structural model that makes it possible to analyze and understand how many separate systems act together.
Mathematica provides state-of-the-art functionality for modeling, analyzing, synthesizing, and visualizing graphs and networks. Whether those graphs are small and diagrammatic or large and complex, Mathematica provides numerous high-level functions for creating or computing with graphs. Graphs are first-class citizens in Mathematica; they can be used as input and output and they are deeply integrated into the rest of the Mathematica system.
Graph construct a graph from vertices and edges
GraphData, ExampleData curated collection of theoretical and empirical graphs
CompleteGraph, GridGraph generate special parametric graphs
AdjacencyGraph, IncidenceGraph construct a graph from matrices
RandomGraph construct random graphs from symbolic graph distributions
Import import graphs from a variety of file formats
"GraphML"  ▪ "GXL"  ▪ "Graphlet"  ▪ "Pajek"  ▪ "TGF"  ▪ "DOT"  ▪ "DIMACS"  ▪ "Graph6"  ▪ "Sparse6"  ▪ "LEDA"
Graph graph object with vertex and edge properties
UndirectedEdge (UndirectedEdge,Esc ue Esc ▪ DirectedEdge (DirectedEdge,Esc de Esc ▪ ...
HighlightGraph highlight vertices, edges, or whole subgraphs
GraphStyle  ▪ GraphHighlightStyle  ▪ GraphLayout  ▪ Style  ▪ Labeled  ▪ VertexStyle  ▪ EdgeStyle  ▪ VertexLabels  ▪ EdgeLabels  ▪ VertexSize  ▪ ...
NeighborhoodGraph graph neighborhood of some vertex, edge etc.
Subgraph  ▪ UndirectedGraph  ▪ GraphIntersection  ▪ GraphUnion  ▪ GraphDifference  ▪ BooleanGraph  ▪ IndexGraph  ▪ VertexReplace  ▪ VertexAdd  ▪ VertexDelete  ▪ EdgeAdd  ▪ EdgeDelete  ▪ ...
IsomorphicGraphQ test whether two graphs are the same after vertex renaming
FindShortestPath find the shortest path between two vertices
ConnectedComponents give groups of vertices that are strongly connected
FindClique find complete subgraphs
DepthFirstScan scan a graph in depth-first order