TDA's graph-drawing command, pltree, only draws trees. For
anything else – a cycle, more than one component, or a directed graph –
this lays the nodes out on a circle and draws it with
tda_pl_graph instead, which takes explicit coordinates and
so can draw any graph.
Arguments
- x
a
tda_graph.- width, height
size of the plotting area in millimetres.
- file
name for the PostScript file.
- newpage
start a new page before drawing.
- layout
"auto"(the default) usespltreewhen the graph is actually a tree (connected, one fewer edge than nodes) and a circular layout otherwise;"circle"always uses the circular layout,"tree"always triespltreeand lets TDA refuse a non-tree graph with its own error.- ...
further options for
pltree(layout = "tree") ortda_pl_graph(layout = "circle").
See also
Other graph analysis:
tda_dmet(),
tda_g(),
tda_g_analyses,
tda_graph(),
tda_locate_line(),
tda_ptree(),
tda_ucl()
Examples
e <- data.frame(from = c(1, 1, 2), to = c(2, 3, 4), value = 1)
g <- tda_graph(e, directed = FALSE) # 4 nodes, 3 edges: already a tree
pdf(NULL); plot(g); dev.off()
#> agg_record_1f9b21c6ab0b
#> 2
# a graph with a cycle is not a tree, and this one is directed besides --
# both are fine with the default circular layout
e2 <- data.frame(from = c(1, 1, 2, 2, 3, 4), to = c(2, 3, 3, 4, 4, 5))
g2 <- tda_graph(e2, directed = TRUE)
pdf(NULL); plot(g2); dev.off()
#> agg_record_1f9b21c6ab0b
#> 2