## Documentation

5 stars based on 52 reviews

In graph theory and computer sciencean adjacency matrix is a square matrix used to represent a finite graph. The elements of the matrix indicate whether pairs of vertices are adjacent or not in the graph. In the special case of a finite simple graphthe adjacency matrix is a 0,1 -matrix with zeros on its diagonal. If the graph binary adjacency matrix undirected, the adjacency matrix is symmetric. The relationship between a graph and the eigenvalues and eigenvectors of its adjacency matrix is studied in spectral graph theory.

The adjacency matrix should be distinguished from the incidence matrix for a graph, a different matrix representation whose elements indicate whether vertex—edge pairs are incident or not, and degree matrix which contains information about the degree of each vertex. It is also sometimes useful in algebraic graph theory to replace the nonzero elements with algebraic variables.

The binary adjacency matrix concept can be extended to multigraphs and graphs with loops by storing the number of edges between each two vertices in the corresponding matrix element, and by allowing nonzero diagonal elements. Loops may be counted either once as a single edge or twice as two vertex-edge incidencesas long as a consistent convention is followed.

Undirected graphs often use the latter convention of counting loops twice, whereas directed graphs typically use the former convention.

The adjacency matrix A of a bipartite graph whose two parts have r and s vertices can be written in the form. In this case, the smaller matrix B uniquely represents the graph, and the remaining parts of A can be discarded as redundant.

B is sometimes called the biadjacency matrix. If G is a bipartite multigraph or weighted graph then the elements b ij are taken to be the number of edges between the vertices or the weight of the edge u iv jrespectively. This matrix is used in studying strongly regular graphs and two-graphs. The distance matrix has in position ij the distance between vertices v i and v j. The distance is the length of a shortest path connecting the vertices.

Unless lengths of edges are explicitly provided, the length of a path is the number of edges in it. The distance matrix resembles a high power of the adjacency matrix, but instead of telling only whether or not two vertices are connected i. The convention followed here for undirected graphs is that each edge adds 1 to the appropriate cell in the matrix, and each loop adds 2.

In directed graphs, the in-degree of a vertex can be computed by summing the entries of the corresponding column, and the out-degree can be computed by summing the entries of the corresponding row. Directed Cayley graph of S 4. As the graph is directed, the matrix is not symmetric. The adjacency matrix of a complete graph contains all ones except along the diagonal where binary adjacency matrix are only zeros.

The adjacency matrix of an empty graph is a zero matrix. The adjacency matrix of an undirected simple graph is symmetricand therefore has a complete set of real eigenvalues and an orthogonal eigenvector basis.

The set of eigenvalues of a graph is the spectrum of the graph. This can be seen as result of the Perron—Frobenius theorembut it can be proved easily. This bound is tight in the Ramanujan graphswhich have applications in many areas. Suppose two directed or undirected graphs G 1 and G 2 with adjacency matrices A 1 and A 2 are given.

G 1 and G 2 are isomorphic if and only if there exists a permutation matrix P such that. In particular, A 1 and A 2 are similar and therefore have the same minimal polynomialbinary adjacency matrix polynomialeigenvalues, determinant and trace.

These binary adjacency matrix therefore serve as isomorphism invariants of graphs. However, two graphs may possess the same set of eigenvalues but not be isomorphic. If A is the binary adjacency matrix matrix of the directed or undirected graph Gthen the matrix A n i. If n is the smallest nonnegative integer, such that for some ijthe binary adjacency matrix ij of A n is positive, then n is the distance between vertex i and vertex j.

This implies, for example, that the number of triangles in an undirected graph G is exactly the trace of Binary adjacency matrix 3 divided by 6.

Binary adjacency matrix that the adjacency matrix can be used to determine whether or not the graph is connected. The adjacency matrix may be binary adjacency matrix as a data structure for the representation of graphs in computer programs for manipulating graphs.

The main alternative data structure, also in use binary adjacency matrix this application, is the adjacency list. Although slightly more succinct representations are possible, this method gets close to the information-theoretic lower bound for the minimum number of bits needed to represent all n -vertex graphs. However, for a large sparse graphadjacency lists require less storage space, because they do not waste any space to represent edges that are not present.

An alternative form of adjacency matrix which, however, requires a larger binary adjacency matrix of space replaces the numbers in each element of the matrix with pointers to edge objects when edges are present or null pointers when there is no edge.

Besides the space tradeoff, the different data structures also facilitate different operations. Finding binary adjacency matrix vertices adjacent to a given vertex in an adjacency list is as simple as reading the list, and takes time proportional to the number of neighbors.

With an adjacency matrix, an entire binary adjacency matrix must instead be scanned, which takes a larger amount of time, proportional to binary adjacency matrix number of vertices in the whole graph. On the other hand, testing whether there is an edge between two given vertices can be determined at once with an adjacency matrix, while requiring time proportional to the binary adjacency matrix degree of the two vertices with binary adjacency matrix adjacency list.

In other projects Wikimedia Commons. This page was last edited on 26 Marchat By using this site, you agree to the Terms of Use and Privacy Policy. White fields are zeros, colored fields are ones. Wikimedia Commons has media related to Adjacency matrices of graphs.