How to find the Laplacian Matrix with Network, please
2 views (last 30 days)
Show older comments
Hi Dear
If we difine L_{ij} of the graph Laplacian are defined by L_{ij} = A_{ij}- k_i delta_{ij}, where A is the adjacency matrix, k_{i} is the degree of node i, delta_{ij} is the Kronecker delta, and where we do not sum over repeated indices.
N=200;L=100; coverage_range=20;
% random coordination
distinct_BOUND = 5;
P = zeros(N,2);
% rand(1,2)<0.05;
Q = rand(1,2)*L;
P(1,:) = Q;
for j = 2:N
u = true;
m = false;
while u || m
Q = rand(1,2)*L ;
% u is true if new added node is too far to all node
u = true;
for i = 1:j-1
if pdist([Q;P(i,:)],'euclidean') < coverage_range
%D = pdist(X) returns the Euclidean distance between pairs of observations in X.
u = false;
end
end
% m is true if new added node is too near to one node
m = false;
for i = 1:j-1
if pdist([Q;P(i,:)],'euclidean') < distinct_BOUND
m = true;
end
end
end
P(j,:) = Q;
end
figure;
OP=gscatter(P(:,1),P(:,2));
r = sprintf('N-%d,L-%d, cr-%d nodes', N, L, coverage_range);
could you help me to find Laplacian, I use Laplacian() but it didn't work, please
0 Comments
Answers (1)
Nipun
on 4 Jun 2024
Hi Ama,
I understand that you intend to find the Laplacian matrix of a given network matrix in MATLAB.
MATLAB has an in-built Laplacian function that works on simple, connected graphs. I recommend cleaning your graph to remove any self-loops and multi-edges. I assume that your graph has these structures that hinder the Laplacian function to calculate the expected matrix.
For more information on syntax, parameters and return type of Laplacian function, refer to the following MathWorks documentation:
Hope this helps.
Regards,
Nipun
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!