construct adjacency matrix
AdjacencyMatrix(G, L, opts)
values for adjacent, nonadjacent, and diagonal entries
(optional) one or more options as specified below
Specifies a datatype for the generated Matrix as described in rtable. The default is datatype=anything.
order=one of C_order or Fortran_order
Specifies the order of the generated Matrix. The default is order=C_order.
shape=name or list of names
Specifies the storage allocation for Matrix entries. Must be a name or list of names specifying one or more built-in or user-defined indexing functions. The default is shape=symmetric if G is undirected and shape= if G is directed.
Specifies the storage mode. The default is storage=sparse if the number of edges is much smaller than the square of the number of vertices; otherwise, it is storage=triangular[upper] if G is undirected and storage=rectangular if G is directed.
The AdjacencyMatrix command returns the adjacency matrix of a graph G whose rows and columns are indexed by the vertices. The entry i,j of this matrix is 1 if there is an edge from vertex i to vertex j and 0 otherwise.
The optional parameter L is a list of three elements specifying alternate special-purpose values for the entries of the adjacency matrix. If specified, the generated matrix has the following properties:
A[i,j] = L when there is an edge from i to j in G
A[i,j] = L when there is no edge from i to j in G
A[i,i] = L along the diagonal
The default behavior corresponds to specifying the list [1,0,0].
The default output is an n by n Matrix with the following properties:
If G is directed or undirected: datatype=anything and order=C_order
If G is undirected: shape=symmetric, storage=triangular[upper],
If G is directed: storage=rectangular, shape=
If G is sparse, i.e., |E| << |V|^2 then storage=sparse is used.
G≔Graph 1: an undirected unweighted graph with 4 vertices and 4 edge(s)
H≔Graph 2: a directed unweighted graph with 4 vertices and 4 arc(s)
The GraphTheory[AdjacencyMatrix] command was updated in Maple 2021.
The L parameter was introduced in Maple 2021.
The datatype, order, shape and storage options were introduced in Maple 2021.
For more information on Maple 2021 changes, see Updates in Maple 2021.
Download Help Document
What kind of issue would you like to report? (Optional)