How to find graph density in MATLAB for a given graph G?
10 次查看(过去 30 天)
显示 更早的评论
I want to find the density of a graph in matlab. Is there any function to find that? Thanks.
0 个评论
采纳的回答
Kelly Kearney
2021-7-2
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 个评论
Steven Lord
2021-7-3
You can use the numnodes and numedges functions on a graph or digraph to get the numbers of nodes or edges respectively.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graph and Network Algorithms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!