Home > matpower7.0 > extras > syngrid > lib > nsw_clusterSW_conn2.m

nsw_clusterSW_conn2

PURPOSE ^

Given the connectivity matrix Ma, examine if the topology is connected

SYNOPSIS ^

function [connected,lambda2,L] = nsw_clusterSW_conn2(Ma)

DESCRIPTION ^

 Given the connectivity matrix Ma, examine if the topology is connected
 and compute its Laplacian and lambda2(L).
 Input:
   Ma - connectivity matrix (N X N), Ma is upper-triangular matrix
 Output:
   connected - 1/0;
   lambda2 - algebraic connectivity;
   L - the Laplacian of the network
 by wzf, 2008

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [connected,lambda2,L] = nsw_clusterSW_conn2(Ma)
0002 % Given the connectivity matrix Ma, examine if the topology is connected
0003 % and compute its Laplacian and lambda2(L).
0004 % Input:
0005 %   Ma - connectivity matrix (N X N), Ma is upper-triangular matrix
0006 % Output:
0007 %   connected - 1/0;
0008 %   lambda2 - algebraic connectivity;
0009 %   L - the Laplacian of the network
0010 % by wzf, 2008
0011 
0012 %   SynGrid
0013 %   Copyright (c) 2008, 2017-2018, Electric Power and Energy Systems (EPES) Research Lab
0014 %   by Zhifang Wang, Virginia Commonwealth University
0015 %
0016 %   This file is part of SynGrid.
0017 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0018 
0019 IMa = or(Ma,Ma');%(Ma+Ma');
0020 dd = sum(IMa,2);
0021 
0022 % first form a Laplace matrix:
0023 % L = [Lij](N by N)-> Lii = node degree, Lij = -1, if i-j connected,
0024 %                                        Lij =  0, otherwise
0025 L = -IMa + diag(dd);
0026 eigL = eig(L);
0027 x = sort(eigL);
0028 lambda2 = x(2);
0029 connected = (lambda2 > 1e-6);
0030 
0031 % NOTE: Laplace matrix is in fact L = A'*A, where A is line index matrix.
0032 % and Ma = -triu(L,1);
0033 % it is sure L always has an eigenvalue to be zero; if the second smallest eigenv
0034 % great than zero, then it is connected. otherwise, it's not.

Generated on Mon 24-Jun-2019 15:58:45 by m2html © 2005