How to find graph density in MATLAB for a given graph G?
9 ビュー (過去 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!