Search for the id of a node in a graph
Examples
# Building a graph dataframe
# Node data frame:
nodes <- data.frame(name = c("Alice", "Bob", "Charlie", "David", "John", "Mary"))
# Edge data frame
edges <- data.frame(from = c(1, 1, 2, 3, 2, 6), to = c(2, 3, 4, 4, 5, 5))
g <- tidygraph::tbl_graph(nodes = nodes, edges = edges)
get_node_id(g, "Bob")
#> [1] 2