Plot nodes and edges in adjacency matrix
Plot half of the carbon-60 molecule, placing asterisks at each node.
k = 1:30; [B,XY] = bucky; gplot(B(k,k),XY(k,[1 2]),'-*') axis square
A— Adjacency matrix
Adjacency matrix, specified as a matrix.
A describes the
connections between the nodes in the graph by the location of nonzero values. If node
i and node
j are connected, then
A(j,i) is nonzero; otherwise,
A(j,i) are zero.
A = ones(5) is the adjacency matrix of a graph with five
nodes where each node is connected to all the others.
A = [0 1 1 1; 1 0 0 0; 1 0 0 0; 1 0 0 0] is the adjacency
matrix of a graph with four nodes where one node connects to the other
XYCoords— xy-coordinates of nodes
xy-coordinates of nodes, specified as an
2 matrix. Each row in
XYCoords defines the coordinates for one node in the graph, so
XYCoords(i,:) = [x(i) y(i)] gives the coordinates for node
XYCoords = [1 2; 3 4] plots one node at (1,2) and a
second node at (3,4).
LineSpec— Line style, marker, and color
Line style, marker, and color, specified as a character vector or string containing symbols. The symbols can appear in any order. You do not need to specify all three characteristics (line style, marker, and color). For example, if you omit the line style and specify the marker, then the plot shows only the marker and no line.
'--or' is a red dashed line with circle markers
|Line Style||Description||Resulting Line|
|Color Name||Short Name||RGB Triplet||Appearance|
y— Node coordinates
Node coordinates, returned as vectors.
contain the same information as
XYCoords, but in a different format
that is suitable for plotting with the command
plot(x,y). The line
segments defined in
y are separated with