node operations | R Documentation |
Add, remove and rename nodes in a graph.
# add and remove nodes.
add.node(x, node)
remove.node(x, node)
# re-label nodes.
rename.nodes(x, names)
## S4 replacement method for signature 'bn'
nodes(object) <- value
## S4 replacement method for signature 'bn.fit'
nodes(object) <- value
x |
an object of class |
object |
an object of class |
node |
a character string, the label of a node. |
value , names |
a vector of character strings, the new set of labels that wll be used as to rename the nodes. |
add.node()
adds a new (isolated) node to an existing bn
object.
remove.node()
removes a node from a bn
object.
rename.nodes()
replaces the node labels with new ones, relabelling the
whole node set. The assignment method for nodes()
is an alias of
rename.nodes()
.
add.node()
, remove.node()
and rename.nodes()
return an
updated bn
object.
Marco Scutari
dag = random.graph(LETTERS[1:5])
add.node(dag, "Z")
remove.node(dag, "A")
nodes(dag)
nodes(dag) = LETTERS[6:10]
nodes(dag)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.