[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Community similarity / dissimilarity
From: |
Tamás Nepusz |
Subject: |
Re: [igraph] Community similarity / dissimilarity |
Date: |
Wed, 19 Dec 2012 22:25:53 +0100 |
> vc = g.community_infomap()
You could try the following:
g2 = g.copy()
g2.contract_vertices(vc.membership)
g2.es["weight"] = 1
g2.simplify(combine_edges="sum")
This would give you a graph where the nodes represent the communities of the
original graph, the edges are weighted, and the weight of an edge going between
node A and B is the number of edges connecting community A and B.
g2.get_adjacency(attribute="weight") would then give you the weighted adjacency
matrix of g2, which is essentially a similarity matrix between the communities.
Of course it is very well conceivable that other similarity or distance
measures make more sense, but this is a good starting point.
> My ultimate goal is to use this similarity matrix and multidimensional
> scaling to make a nice 2d layout of the discovered communities
You can use any layout algorithm on g2 (including g2.layout_mds for what it's
worth) to obtain a layout.
Cheers,
Tamas