[Laplacian function in Matlab2017] Undefined function 'laplacian' for input arguments of type 'double'.

Hello,
What is wrong with the following code. I got an input error argument for laplacian.
n = 1000;
x = randperm(n);
gs = 450; group1 = x(1:gs); group2 = x(gs+1:end);
p_group1 = 0.5; p_group2 = 0.4; p_between = 0.1;
A(group1, group1) = rand(gs,gs) < p_group1;
A(group2, group2) = rand(n-gs,n-gs) < p_group2;
A(group1, group2) = rand(gs, n-gs) < p_between;
A = triu(A,1);
A = A + A';
spy(A);
L = laplacian(A);
I got the following error :
Undefined function 'laplacian' for input arguments of type 'double'.
l'm using Matlab2017b
Thank you

 Respuesta aceptada

I suspect you're trying to call this function. If so the input must be a graph object, not simply an adjacency matrix. Create a graph object using A then pass that graph object into laplacian.

5 comentarios

see Finding a Partition. Just called the laplacian with only an adjacency matrix
David Gleich wrote the package MatlabBGL, perhaps this contains a laplacian function? It's not a standard MATLAB function.
I just checked it doesn't contain a laplacian function
@ Steven Lord, is there a way to get a graph object from my adjacency matrix A ?
From the second link I posted:
"G = graph(A) creates a weighted graph using a square, symmetric adjacency matrix, A."

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Graph and Network Algorithms en Centro de ayuda y File Exchange.

Preguntada:

el 26 de Oct. de 2017

Comentada:

el 26 de Oct. de 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by