%% Reconstruct Weighted Adjacency Matrix
% Create a weighted graph.

G = digraph([1 1 1 2 3 4],[2 3 4 4 2 3],[5 6 7 8 9 10]);
G.Edges

%
% Find the adjacency matrix of the graph.

A = adjacency(G)

%
% This form of the adjacency matrix does not include the edge weights. Use the 'weighted' option to include the edge weights in the adjacency matrix.

A = adjacency(G,'weighted')

%
% Preview a full storage version of the matrix. Since G is a directed graph, the adjacency matrix is not symmetric. However, the adjacency matrix is symmetric for undirected graphs.

B = full(A)

% Copyright 2015 The MathWorks, Inc.