www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/AdjacencyMatrixDigraphConstructionExample.m

    %% Adjacency Matrix Graph Construction
% Create a symmetric adjacency matrix, |A|, that creates a complete
% directed graph of order 4. Use a logical adjacency matrix to create a
% graph without weights.

% Copyright 2015 The MathWorks, Inc.

A = ones(4) - diag([1 1 1 1])

%%
%
G = digraph(A~=0)

%%
% View the edge list of the graph.
G.Edges