FormationControlSimulation/SOURCE/networks-toolbox/isRegular.m

15 lines
360 B
Matlab
Raw Normal View History

2019-06-17 14:31:50 +07:00
% Check whether a graph is regular, i.e. whether every node has the same degree.
%
% INPUTS: adjacency matrix, nxn
% OUTPUTS: Boolean, 0 or 1
%
% Note: Defined for unweighted graphs only.
% GB: last updated, Sep 23, 2012
function S=isRegular(adj)
S=false;
degs=sum(adj>0); % remove weights and sum columns
if degs == degs(1)*ones(size(degs)); S = true; end