Does distances measure the distance between the node and itself?
How to highlight isolated nodes in a graph?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Asaf McRock
le 22 Fév 2021
Modifié(e) : Asaf McRock
le 24 Fév 2021
Hello, how can I highlight isolated nodes in a graph?
I have tried the following but didn't work:
d=distances(G,(1:N)); % N is the no. of nodes
idx= ismember(d,inf(1,length(d)), 'rows');
H=plot(G,'XData',x,'YData',y);
highlight(H,idx)
Thanks!
Réponse acceptée
Steven Lord
le 22 Fév 2021
You want to highlight those nodes that are not connected to any other?
G = graph(sprand(10, 10, 0.05), 'upper');
h = plot(G);
highlight(h, degree(G) == 0, 'NodeColor', 'r')
1 commentaire
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Graph and Network Algorithms dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!