How to find graph density in MATLAB for a given graph G?
조회 수: 12 (최근 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!