How do I classify networks by topology?
Show older comments
I have a file with edges which, when I create a graph, shows multiple different networks.
Most of them are simple two-node networks, some are much more complex.
I am new to Matlab and therefore I am wondering if there is a way to make Matlab classify those networks by topology and then count how many distinct types of topologies exist in this dataset.
Perhaps it is a matter of separating the networks in distinct files before Matlab, but just wanted to ask if it is possible to make Matlab do the work.
Answers (1)
Christine Tobler
on 16 Nov 2016
Sorry for picking this up months after the fact, I just happened on your question now.
You can use the CONNCOMP command to get a list of all the components (subgraphs of nodes connected by edges) in your graph.
binCell = conncomp(g, 'Type', 'weak', 'OutputForm', 'cell');
The size of each element of the cell array binCell is the number of nodes in that component. For more detailed descriptions of the individual components, you would do best to extract each individual component using the subgraph command:
for i=1:numel(binCell)
gCell{i} = subgraph(g, binCell{i});
end
You can then use cellfun to examine all subgraphs at once:
cellfun(@numedges, gCell)
Categories
Find more on Networks in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!