Description Usage Arguments Value References Examples
Compute the k-truss of an undirected graph.
1 |
k |
The level of support, requiring that every edge in subgraph is in
at least (k-2) triangles (J. Cohen 2008). |
color_graph |
Logical to color the graph (perform truss membership). |
graph |
An undirected graph (must be igraph). |
A subgraph containing all k-trusses in the graph for a given level of support k
.
J. Cohen. Trusses: Cohesive subgraphs for social network analysis, 2008.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | require(igraph)
set.seed(1)
g <- sample_gnm(6, 9)
E(g)$eid <- seq(ecount(g))
g_truss <- truss(g, k = 3)
# Plot original graph.
fixed_layout <- layout_with_lgl(g)
plot(g, layout = fixed_layout) # original
# Plot graph with truss clustering.
E(g)$weight <- 1
E(g)$color <- "gray"
E(g)[E(g_truss)$eid]$color <- "blue"
E(g)[E(g_truss)$eid]$weight <- 3
plot(g, layout = fixed_layout, edge.width = E(g)$weight) # with truss
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.