# Wolfram Language & System 10.3 (2015)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.
BUILT-IN WOLFRAM LANGUAGE SYMBOL

gives the graph with adjacency matrix amat.

gives the graph with vertices and adjacency matrix amat.

## Details and OptionsDetails 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 & ContextBackground & 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 are non-negative integers that give the numbers of (directed) edges from vertex to vertex . 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 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.

## ExamplesExamplesopen allclose all

### Basic Examples  (2)Basic Examples  (2)

Construct a graph from an adjacency matrix:

 Out[1]=

A symmetric adjacency matrix results in an undirected graph:

 Out[1]=