library(ggraph)
## Loading required package: ggplot2
library(igraph)
##
## Attaching package: 'igraph'
## The following objects are masked from 'package:stats':
##
## decompose, spectrum
## The following object is masked from 'package:base':
##
## union
library(tidygraph)
##
## Attaching package: 'tidygraph'
## The following object is masked from 'package:igraph':
##
## groups
## The following object is masked from 'package:stats':
##
## filter
library(ggforce)
library(concaveman)
graph <- graph_from_data_frame(highschool)
g<-as_tbl_graph(graph)
g %>% activate(nodes) %>%
mutate(community = as.factor(group_edge_betweenness())) -> g
ggraph(g) +
geom_edge_link() +
geom_node_point(aes(fill=community, size=4), shape=21)+
geom_mark_ellipse(aes(x = x, y = y, fill = community))
## Using `stress` as default layout

ggraph(g) +
geom_edge_link() +
geom_node_point(aes(fill=community, size=4), shape=21)+
geom_mark_hull(aes(x = x, y = y, fill = community))
## Using `stress` as default layout
