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.
Graph — represent a general graph, or create it from vertices and edges
UndirectedEdge — an undirected edge () (also entered as <->)
DirectedEdge — a directed edge () (also entered as ->)
Basic Properties
VertexList, EdgeList — the list of vertices and edges in the graph
VertexIndex, EdgeIndex — the index for a vertex or edge in a graph
AdjacencyList ▪ IncidenceList ▪ EdgeRules ▪ PlanarFaceList
Matrix Representations »
AdjacencyMatrix, AdjacencyGraph — matrix representation and graph construction
IncidenceMatrix ▪ KirchhoffMatrix ▪ WeightedAdjacencyMatrix ▪ ...
Graph Annotations »
AnnotationValue — get and set vertex or edge annotation values
EdgeWeight ▪ VertexWeight ▪ EdgeCapacity ▪ VertexCapacity ▪ ...
Import and Export Graphs »
Import, Export — import and export graphs
"GraphML" ▪ "GXL" ▪ "Graphlet" ▪ "Pajek" ▪ "TGF" ▪ "DOT" ▪ "DIMACS" ▪ "Graph6" ▪ "Sparse6" ▪ "LEDA"
Curated Graphs
GraphData — collection of theoretical graphs
ExampleData — collection of empirical graphs
Polyhedron Chemical Word Country Isotope Species ...
Parametric Graphs
CompleteGraph — generate a complete or a complete k-partite graph
BuckyballGraph ▪ ButterflyGraph ▪ CirculantGraph ▪ CompleteKaryTree ▪ CycleGraph ▪ DeBruijnGraph ▪ GridGraph ▪ HararyGraph ▪ HypercubeGraph ▪ KaryTree ▪ KnightTourGraph ▪ PetersenGraph ▪ StarGraph ▪ TorusGraph ▪ TuranGraph ▪ WheelGraph
Structured Graphs
PathGraph — general directed or undirected path
TreeGraph — general directed or undirected tree
PlanarGraph — general directed or undirected planar graph
Graphs from Data
RelationGraph — generate a graph based on data and a binary relation
NearestNeighborGraph — generate the k-nearest neighbor graph for general elements
NestGraph — generate a nested function graph
ExpressionGraph — generate a graph of the tree structure of expressions
ClusteringTree — generate a tree from hierarchical clustering of elements
CayleyGraph ▪ MoleculeGraph ▪ MeshConnectivityGraph ▪ MorphologicalGraph
Random Graphs »
RandomGraph — generate random graphs following a graph distribution
GraphPropertyDistribution ▪ UniformGraphDistribution ▪ ...
Operations and Modifications of Graphs »
Subgraph — extract subgraphs
NeighborhoodGraph ▪ GraphUnion ▪ VertexAdd ▪ EdgeAdd ▪ ...