A graph for TDA's graph commands
Arguments
- edges
an edge list – from, to, and one value, or two values when the graph carries a different one in each direction, as the shipped
gd1.datdoes – or a square adjacency matrix, or adist.- directed
whether the graph is directed.
FALSEemitsgt=2. Several commands –tda_g_componentsamong them, andplot.tda_graph'slayout = "tree"– only work on an undirected graph, and TDA itself refuses a directed one for them;directed = TRUE(the default here) is right for ordinary, arrow-drawn graphs, but a tree needsFALSE, since a tree's layout comes from which nodes are connected, not which way an edge happens to point.- form
how TDA is to read it:
"edges"for an edge list, which isgddoption 1, or"dissimilarity"for the upper triangle of a dissimilarity matrix, option 4.- options
a named list of further
gddoptions.
See also
Other graph analysis:
plot.tda_graph(),
tda_dmet(),
tda_g(),
tda_g_analyses,
tda_locate_line(),
tda_ptree(),
tda_ucl()
Examples
e <- data.frame(from = c(1, 1, 2, 3), to = c(2, 3, 4, 4), value = 1)
# gcon works on an undirected graph only, so `directed = FALSE`
tda_g_components(tda_graph(e, directed = FALSE))
#> Call: tda_g_components(tda_graph(e, directed = FALSE))
#>
#> Cases: 4
#>
#> component n i node_i
#> 1 4 1 1
#> 1 4 2 2
#> 1 4 3 3
#> 1 4 4 4