Constructing Graphs

In Mathematica, graphs can be constructed in a variety of ways. They can be built from vertices and edges directly in a symbolic form. They can come from built-in curated collections of theoretical or empirical graphs. Special graphs can be generated from parametric specifications. Random graphs following a variety of graph distributions allow you to build simulated internets or citation graphs and test algorithms. Graphs can be fully specified by several types of matrices, or they can be imported from numerous supported file formats. Graphs can also be constructed in several steps by performing operations on graphs.


Graph construct a graph from vertices and edges

UndirectedEdge () ▪ DirectedEdge ()

Curated Graphs

GraphData collection of theoretical graphs

ExampleData collection of empirical graphs

SocialMediaData graph data from social sites (Facebook, Twitter, ...)

PolyhedronData ▪ ChemicalData ▪ WordData ▪ CountryData ▪ IsotopeData

Parametric Graphs

CompleteGraph generate a complete or a complete -partite graph

ButterflyGraph ▪ CirculantGraph ▪ CompleteKaryTree ▪ CycleGraph ▪ DeBruijnGraph ▪ GridGraph ▪ HararyGraph ▪ HypercubeGraph ▪ KaryTree ▪ KnightTourGraph ▪ PathGraph ▪ PetersenGraph ▪ StarGraph ▪ TreeGraph ▪ TuranGraph ▪ WheelGraph

Random Graphs »

RandomGraph generate random graphs following a graph distribution

GraphPropertyDistribution ▪ UniformGraphDistribution ▪ ...

Matrix Graphs »

AdjacencyGraph construct a graph from an adjacency matrix

IncidenceGraph ▪ KirchhoffGraph ▪ WeightedAdjacencyGraph ▪ ...

Importing Graphs »

Import import graphs from different graph file formats

"GraphML" ▪ "GXL" ▪ "Graphlet" ▪ "Pajek" ▪ "TGF" ▪ "DOT" ▪ ...

Operations and Modifications of Graphs »

Subgraph extract subgraphs

NeighborhoodGraph ▪ GraphUnion ▪ VertexAdd ▪ EdgeAdd ▪ ...

New to Mathematica? Find your learning path »
Have a question? Ask support »