Description Usage Arguments Examples
View source: R/attribute_seed.R
Use 'attribute_seed()' to seed network nodes with diffusion points based on given vertex attributes.
1 | attribute_seed(graph, attr_expression)
|
graph |
Graph of class ' |
attr_expression |
A logical expression defined in terms of the attribute names of |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # generate a graph
vertex_meta <- data.frame('name' = c('a','b','c','d'), value = c(1, 5, 10, 3))
edge_list <- data.frame('v1' = c('a', 'a', 'd', 'd'), 'v2' = c('b', 'c', 'a', 'c'))
graph <- igraph::graph_from_data_frame(d = edge_list, vertices = vertex_meta, directed = FALSE)
# examine initial graph
igraph::vertex_attr(graph)
# seed graph by node value
seeded_graph <- attribute_seed(graph = graph, value > 4)
# examine seeded graph
igraph::vertex_attr(seeded_graph)
# there is now a node attribute 'seed', which is equal to 1 for nodes b and c,
# and 0 for nodes a and d.
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.