Graph Construction & Representation

Graphs are first-class citizens in the Wolfram Language 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. 

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.

(RefLink[Graph, paclet:ref/Graph]) — represent a general graph, or create it from vertices and edges

(RefLink[UndirectedEdge, paclet:ref/UndirectedEdge]) — an undirected edge (<->) (also entered as <->)

(RefLink[DirectedEdge, paclet:ref/DirectedEdge]) — a directed edge (->) (also entered as ->)

Basic Properties

(RefLink[VertexList, paclet:ref/VertexList]), (RefLink[EdgeList, paclet:ref/EdgeList]) — the list of vertices and edges in the graph

(RefLink[VertexIndex, paclet:ref/VertexIndex]), (RefLink[EdgeIndex, paclet:ref/EdgeIndex]) — the index for a vertex or edge in a graph

(OrangeLink[Matrix Representations », paclet:guide/GraphsAndMatrices])

(RefLink[AdjacencyMatrix, paclet:ref/AdjacencyMatrix]), (RefLink[AdjacencyGraph, paclet:ref/AdjacencyGraph]) — matrix representation and graph construction

(OrangeLink[Graph Properties », paclet:guide/GraphProperties])

(RefLink[PropertyValue, paclet:ref/PropertyValue]) — get and set vertex or edge property values

(OrangeLink[Import and Export Graphs, paclet:guide/MathematicalDataFormats])

(RefLink[Import, paclet:ref/Import]), (RefLink[Export, paclet:ref/Export]) — import and export graphs

Curated Graphs

(RefLink[GraphData, paclet:ref/GraphData]) — collection of theoretical graphs

(RefLink[ExampleData, paclet:ref/ExampleData]) — collection of empirical graphs

(RefLink[SocialMediaData, paclet:ref/SocialMediaData]) — graph data from social sites (Facebook, Twitter, …)

Parametric Graphs

(RefLink[CompleteGraph, paclet:ref/CompleteGraph]) — generate a complete or a complete k-partite graph

Structured Graphs

(RefLink[PathGraph, paclet:ref/PathGraph]) — general directed or undirected path

(RefLink[TreeGraph, paclet:ref/TreeGraph]) — general directed or undirected tree

(RefLink[PlanarGraph, paclet:ref/PlanarGraph]) — general directed or undirected planar graph

Graphs from Data

(RefLink[RelationGraph, paclet:ref/RelationGraph]) — generate a graph based on data and a relation

(RefLink[NearestNeighborGraph, paclet:ref/NearestNeighborGraph]) — generate the k-nearest neighbor graph for general elements

(RefLink[NestGraph, paclet:ref/NestGraph]) — generate a nested function graph

(RefLink[ClusteringTree, paclet:ref/ClusteringTree]) — generate a tree from hierarchical clustering of elements

(OrangeLink[Random Graphs », paclet:guide/RandomGraphs])

(RefLink[RandomGraph, paclet:ref/RandomGraph]) — generate random graphs following a graph distribution

(OrangeLink[Operations and Modifications of Graphs », paclet:guide/GraphModifications])

(RefLink[Subgraph, paclet:ref/Subgraph]) — extract subgraphs