How to find graph density in MATLAB for a given graph G?
12 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I want to find the density of a graph in matlab. Is there any function to find that? Thanks.
0 commentaires
Réponse acceptée
Kelly Kearney
le 2 Juil 2021
You can simply calculate the number of non-zero elements relative to total elements in the adjacency matrix:
nnz(adjacency(G))./numel(adjacency(G))
3 commentaires
Steven Lord
le 3 Juil 2021
You can use the numnodes and numedges functions on a graph or digraph to get the numbers of nodes or edges respectively.
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!