How do I find overlapping community structures using R?

I have two questions:

1- I was wondering if it is possible to reveal overlapping community structures in R using igraph?

2- I found that LinkComm package can do something like this (find onverlapping community structures), but it cannot accept and graphics networks, is it possible to apply LinkComm functions to igraph graphics?

Thanks in advance,

+3


source to share


1 answer


Here's a (rather dirty) trick to use a package linkcomm

with objects igraph

. The difficulty is that it linkcomm

uses the package igraph0

and uses the igraph

objects' fields directly, and this is not suggested. Their approach works on a package igraph0

, but not on a package igraph

, because it igraph

defines an indexing operator [[

for graph plots.

In any case, the following just overwrites the function from the package linkcomm

. It works with package version 1.0-6 (2011-05-27) and it almost certainly won't work with any other version. The correct fix will update the package by linkcomm

its author.



library(linkcomm)

# This will result a long warning about masked objects, because igraph 
# defines almost all names igraph0 defines, and linkcomm loads igraph0.
# But we are fine if we load igraph after linkcomm, because by default
# the igraph functions will be used
library(igraph)

# Modify the function from the linkcomm package, we create a new 
# function called 'lc'
lc <- as.list(getLinkCommunities)
lc[[11]][[10]][[3]] <- call("get.edgelist", quote(x), names=FALSE)
lc <- as.function(lc)

# Get some test data
karate <- nexus.get("karate")

# Use the newly defined 'lc' function on the test data
karcomm <- lc(get.data.frame(karate), check.duplicates=FALSE)

      

result plot

+3


source







All Articles