How to find graph density in MATLAB for a given graph G?
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Nadatimuj
am 2 Jul. 2021
Kommentiert: Nadatimuj
am 3 Jul. 2021
I want to find the density of a graph in matlab. Is there any function to find that? Thanks.
0 Kommentare
Akzeptierte Antwort
Kelly Kearney
am 2 Jul. 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 Kommentare
Steven Lord
am 3 Jul. 2021
You can use the numnodes and numedges functions on a graph or digraph to get the numbers of nodes or edges respectively.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Graph and Network Algorithms finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!