FormationControlSimulation/SOURCE/networks-toolbox/subgraph.m

12 lines
380 B
Matlab
Raw Permalink Normal View History

2019-06-17 14:31:50 +07:00
% This function outputs the adjacency matrix of a subgraph given
% the supergraph and the node set of the subgraph.
%
% INPUTs: adj - supergraph adjacency matrix (nxn), S - vector of subgraph node indices
% OUTPUTs: adj_sub - adjacency matrix of the subgraph (length(S) x length(S))
%
% GB: last update, September 23 2012
function adj_sub = subgraph(adj,S)
adj_sub = adj(S,S);