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

    %% Adjacency Matrix of Graph
% Create a directed graph using an edge list, and then find the equivalent
% adjacency matrix representation of the graph. The adjacency matrix is
% returned as a sparse matrix.

% Copyright 2015 The MathWorks, Inc.

s = [1 1 1 2 2 3];
t = [2 3 4 5 6 7];
G = digraph(s,t)

%%
% 
A = adjacency(G)