gives the graph with adjacency matrix amat.

gives the graph with vertices vi and adjacency matrix amat.

# Details and Options

• AdjacencyGraph takes the same options as Graph.
• The option DirectedEdges can be used to control whether an undirected or directed graph is constructed.
• The following settings for DirectedEdges can be used in AdjacencyGraph:
•  Automatic undirected graph if amat is symmetric True construct a directed graph False construct an undirected graph

# Background & Context

• AdjacencyGraph constructs a graph from an adjacency matrix representation of an undirected or directed graph. An adjacency matrix is a square matrix whose rows and columns correspond to the vertices of a graph and whose elements aij are non-negative integers that give the numbers of (directed) edges from vertex vi to vertex vj. Adjacency matrices with diagonal entries create self-loops.
• The option DirectedEdges (with possible values Automatic, True, or False) may be used to control whether an undirected or directed graph is constructed. By default, AdjacencyGraph returns an undirected graph if the input matrix is symmetric and a directed graph otherwise.
• AdjacencyGraph takes the same options as Graph (e.g. EdgeStyle, VertexStyle, EdgeLabels, VertexLabels, GraphLayout, VertexCoordinates, etc.). AdjacencyGraph does not take graph weights into account, so WeightedAdjacencyGraph must be used when constructing a graph from a weighted adjacency matrix.
• AdjacencyList returns a list of vertices adjacent to a given vertex vi and therefore corresponds to a list of the positions of nonzero elements in the i column (and, in the case of undirected graphs, the i row) of the adjacency matrix. The entire adjacency matrix of any graph (including a graph constructed using AdjacencyGraph) may be returned using AdjacencyMatrix. IncidenceGraph uses an incidence matrix representation instead of an adjacency matrix to construct a graph.

# Examples

open allclose all

## Basic Examples(2)

Construct a graph from an adjacency matrix:

 In[1]:=
 Out[1]=

A symmetric adjacency matrix results in an undirected graph:

 In[1]:=
 Out[1]=