How to choose neighbors in MATLAB
Mostrar comentarios más antiguos
Hello all, I am dealing with following Graph. Here I had found out neighbors of node 'i' and 'j' as below:
sr = [1,2,2,2,2,3,3,3,3,4,4,5,6,6,6,7]; % various possible Source
ta = [2,1,3,6,8,2,4,6,7,3,6,6,3,4,5,3]; % various possible Targets
G = graph(sr,ta); % models the Graph
for m = 1:length(sr)
i = sr(m);
j = ta(m);
k1 = (neighbors(G,i))'; % neighbors of node 'i'
k2 = (neighbors(G,j))'; % neighbors of node 'j'
end
My query is how can we include these neighbors k1, k2 such that their values is not equal to i and j. Any help in this regard will be highly appreciated.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Nearest Neighbors en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!