- Notifications
You must be signed in to change notification settings - Fork1
License
NotificationsYou must be signed in to change notification settings
cmclean5/rSpectral
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
The goal of ‘rSpectral’ is to make Spectral Modularity graph clusteringmethod available to most of R graph frameworks.
You can install the development version of rSpectral fromGitHub 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
- load the karate club graph and plot Faction membership:
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':#>#> uniondata(karate,package="igraphdata")l<-layout_nicely(karate)memT<-V(karate)$Factionpalette<- rainbow(max(as.numeric(memT)))plot(karate,vertex.color=palette[memT],layout=l)
- run spectral clustering on graph
mem0<-igraph::membership(rSpectral::spectral_igraph_communities(karate))
- plot the graph with membership colors
palette<- rainbow(max(as.numeric(mem0)))plot(karate,vertex.color=palette[mem0],layout=l)
- run spectral clustering on graph, fixing neighbouring nodes found insame community
mem1<-igraph::membership(rSpectral::spectral_igraph_communities(karate,fix_neig=1))
- and plot again
palette<- rainbow(max(as.numeric(mem1)))plot(karate,vertex.color=palette[mem1],layout=l)
- run spectral clustering - fixing neighbouring nodes, Cnmin=5
mem1.5<-igraph::membership(rSpectral::spectral_igraph_communities(karate,fix_neig=1,Cn_min=5))
- and the last plot
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 typescould be converted either toigraph or toGraphNEL by packages suchasIntergraph.
About
No description, website, or topics provided.
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Contributors2
Uh oh!
There was an error while loading.Please reload this page.



