%% Adjacency Matrix Construction with Node Names
% Create an adjacency matrix.

A = magic(4);
A(A>10) = 0

%
% Create a graph with named nodes using the adjacency matrix. Specify 'omitselfloops' to ignore the entries on the diagonal of A.

names = {'alpha' 'beta' 'gamma' 'delta'};
G = digraph(A,names,'omitselfloops')

%
% View the edge and node information.

G.Edges

%

G.Nodes

% Copyright 2015 The MathWorks, Inc.