High-Performance Open-Source Archive
The goal of ‘rSpectral’ is to make Spectral Modularity graph clustering method available to most of R graph frameworks.
You can install the development version of rSpectral from GitHub with:
# install.packages("devtools")
devtools::install_github("cmclean5/rSpectral")The stable version is available on CRAN:
install.packages("rSpectral")This is a basic example which shows you how to solve a common problem
library(rSpectral)
library(igraph)
#>
#> Attaching package: 'igraph'
#> The following objects are masked from 'package:stats':
#>
#> decompose, spectrum
#> The following object is masked from 'package:base':
#>
#> union
data(karate, package="igraphdata")
l<-layout_nicely(karate)
memT<-V(karate)$Faction
palette <- rainbow(max(as.numeric(memT)))
plot(karate,vertex.color=palette[memT],layout=l)
mem0<-igraph::membership(rSpectral::spectral_igraph_communities(karate))palette <- rainbow(max(as.numeric(mem0)))
plot(karate,vertex.color=palette[mem0],layout=l)
mem1<-igraph::membership(
rSpectral::spectral_igraph_communities(karate, fix_neig=1))palette <- rainbow(max(as.numeric(mem1)))
plot(karate,vertex.color=palette[mem1],layout=l)
mem1.5<-igraph::membership(
rSpectral::spectral_igraph_communities(karate, fix_neig=1,Cn_min=5))palette <- rainbow(max(as.numeric(mem1.5)))
plot(karate,vertex.color=palette[mem1.5],layout=l)
GraphNEL objects could be processed similarily, all
other graph types could be converted either to igraph or to
GraphNEL by packages such as Intergraph.
Need mirroring services?
Contact our team at info@vpspulse.com.
Mirror powered by VPSpulse
Infrastructure sponsored by VPSPulse & Secure Payments by ArionPay.