This adds an edge to the graph and reports TRUE if addition was successful.

add_edge(g, start, target)

Arguments

g

A nctx graph

start

ID of the source vertex

target

ID of the target vertex

Value

TRUE if addition was successful

Examples

library(RUnit) library(nctx) g <- create_graph(directed=TRUE) checkTrue(nctx::is_directed(g))
#> [1] TRUE
#> [1] TRUE
#> [1] TRUE
#> [1] TRUE
v_s <- c(v_s, sapply(1:9,function(x){add_vertex(g)})) checkEquals(v_s, c(1:10))
#> [1] TRUE
#> [1] TRUE
add_edge(g, 1, 2)
#> [1] TRUE
#> [1] TRUE
add_edge(g, 2, 3)
#> [1] TRUE
add_edge(g, 3, 4)
#> [1] TRUE
add_edge(g, 4, 5)
#> [1] TRUE
add_edge(g, 3, 5)
#> [1] TRUE
add_edge(g, 5, 9)
#> [1] TRUE
add_edge(g, 6, 4)
#> [1] TRUE
add_edge(g, 7, 4)
#> [1] TRUE
add_edge(g, 2, 6)
#> [1] TRUE
add_edge(g, 8, 2)
#> [1] TRUE
add_edge(g, 9, 4)
#> [1] TRUE
add_edge(g, 3, 10)
#> [1] TRUE
add_edge(g, 10, 5)
#> [1] TRUE
add_edge(g, 10, 9)
#> [1] TRUE
#> [1] TRUE