The package includes all centrality indices implemented in igraph and additionally all that are made available in the netrankr package. All indices can be found in the function group centrality_*().
Warning: Using the `size` aesthetic in this geom was deprecated in ggplot2 3.4.0.
ℹ Please use `linewidth` in the `default_aes` field and elsewhere instead.
13.2 Clustering
Similar to centrality, all clustering algorithms from igraph are available via group_*()
# create random graph with group structure (igraph equivalent is sample_islands())play_islands(4, 12, 0.8, 4) %>%mutate(community =as.factor(group_louvain())) %>%ggraph(layout ="stress") +geom_edge_link0() +geom_node_point(aes(fill = community), shape =21, size =6) +theme_graph()
Coupling this with what we learned above, we can color the edges according to the cluster they belong to.
tidygraphs harmonizes many other available functions in igraph to make them easier accessible. The best way to check what is available is to look at the function groups node_*() and edge_*(). Some simple examples are shown below.
# the node id of the Medici is 9flo_tidy %>%activate("nodes") %>%mutate(dist2Medici =node_distance_to(nodes =9)) %>%activate("edges") %>%mutate(edge2Medici =edge_is_incident(9)) %>%ggraph("stress") +geom_edge_link0(aes(edge_color = edge2Medici)) +geom_node_point(aes(fill = dist2Medici), size =9, shape =21) +theme_graph()