An R package for the implementation of the "Smith-Pittman" (2024) community detection algorithm. Compatible with the igraph ecosystem.
To install the stable release of this package from CRAN run:
install.packages("ig.degree.betweenness")
To install the development version of this package run:
# install.packages("devtools")
devtools::install_github("benyamindsmith/ig.degree.betweenness")
Applying the Smith-Pittman algorithm can be done by making use of the cluster_degree_betweenness()
.
An example of using the code is:
library(igraphdata)
library(ig.degree.betweenness)
data("karate")
sp <- cluster_degree_betweenness(karate)
plot(
sp,
karate,
main= "Smith-Pittman Clustering"
)
The present limitations of using this algorithm is that graphs are required to be labeled for the operations to work. For unlabeled graphs, graphs can be prepared with the prep_unlabled_graph()
function.
Example:
library(igraph)
library(igraphdata)
library(ig.degree.betweenness)
data("UKfaculty")
# Making graph undirected so it looks nicer when its plotted
uk_faculty <- prep_unlabeled_graph(UKfaculty) |>
as.undirected()
ndb <- cluster_degree_betweenness(uk_faculty)
plot(
ndb,
uk_faculty,
main= "Smith-Pittman Clustering for UK Faculty"
)