bGraph {classGraph} | R Documentation |
Create a “Branch Graph”, i.e., a simple tree with root and n (simple) branches or leaves.
bGraph(n, root = "Mom", leaves = paste(l.prefix, seq(length = n), sep = ""), l.prefix = "D", weights = NULL, mode = c("undirected", "directed"))
n |
integer specifying the number of leave branches. |
root |
the node on which to root the tree. |
leaves |
the nodes to be used as leaves. |
l.prefix |
a string specifying ..... |
weights |
....... |
mode |
string indicating which mode is to be used. |
a graph object of class graphNEL
.
Martin Maechler, Aug.2005
class graphNEL
;
ftM2graphNEL
.
(bg7 <- bGraph(7)) # 8 nodes {Mom, D1..D7}; 7 edges plot(bg7) # draws the graph (bgD3 <- bGraph(3, mode="directed")) plot(bgD3) # directed: using arrows (bgw2 <- bGraph(2, weights = c(10,1))) plot(bgw2) # {maybe use lwd for weights in the future?} if(require("Matrix")) show(as(bgw2, "sparseMatrix")) # shows the weights