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

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.


Construction of Graphs »

Graph construct a graph from vertices and edges

GraphData, ExampleData curated collection of theoretical and empirical graphs

CompleteGraph ▪ RandomGraph ▪ AdjacencyGraph ▪ Import ▪ ...

Representation of Graphs »

Graph graph object with vertex and edge properties

UndirectedEdge (UndirectedEdge) ▪ DirectedEdge (DirectedEdge) ▪ ...

Social Network Analysis »

FindGraphCommunities find well-connected communities

SocialMediaData ▪ BetweennessCentrality ▪ FindKClan ▪ ...

Styling, Labeling, and Layout »

HighlightGraph highlight vertices, edges, or whole subgraphs

GraphLayout ▪ VertexStyle ▪ EdgeStyle ▪ VertexLabels ▪ ...

Operations and Modifications »

NeighborhoodGraph graph neighborhood of some vertex, edge, etc.

Subgraph ▪ GraphUnion ▪ VertexAdd ▪ VertexDelete ▪ EdgeAdd ▪ ...

Predicates and Properties »

IsomorphicGraphQ test whether two graphs are the same after vertex renaming

DirectedGraphQ ▪ AcyclicGraphQ ▪ HamiltonianGraphQ ▪ ...

Measures and Metrics »

GraphDistance the length of the shortest path between two vertices

VertexDegree ▪ VertexEccentricity ▪ PageRankCentrality ▪ ...

Paths, Cycles and Flows »

FindMaximumFlow find the maximum flow between two vertices

FindShortestPath ▪ FindHamiltonianCycle ▪ FindPostmanTour ▪ ...

Components and Connectivity »

ConnectedComponents give groups of vertices that are strongly connected

WeaklyConnectedComponents ▪ KCoreComponents ▪ EdgeConnectivity ▪ ...

Cliques, Covers, and Independent Sets »

FindClique find complete subgraphs

FindVertexCover ▪ FindEdgeCover ▪ FindIndependentEdgeSet ▪ ...

Graph Programming »

DepthFirstScan scan a graph in depth-first order

BreadthFirstScan ▪ PropertyValue ▪ AdjacencyMatrix ▪ ...