vignettes/02-why-invert-edges.Rmd
02-why-invert-edges.Rmd
Sometimes, the direction of the edges in the graphs produced with ptrap is inverted.
Every edge correspond to the part of a branch that connect one node to another. By convention each edge should be directed outward: pointing from the node closer to the base of the panicle to the one further away.
You can understand this better by looking at the panicle graphs: we provide two panicle graph objects:
good_panicle
in which every edge points outward.inverted_panicle
in which the edges on the main rachis axis point inward.We can see this comparing the graphs.
The good_panicle
graph has no inverted edges:
good_panicle %>% plot_panicle()
Compare the previous graph with the one below, representing the inverted_panicle
object. In the graph below, the edges on the main axis are inverted.
inverted_panicle %>% plot_panicle()
If you find a panicle with inverted edges on the main axis, you can use the function invert_edges()
to revert them.
tst <- inverted_panicle %>% invert_edges()
tst %>% plot_panicle()
inverted_panicle %>%
invert_edges(check_before = TRUE) %>%
plot_panicle()
good_panicle %>%
invert_edges(check_before = TRUE) %>%
plot_panicle()