add_prism {DiagrammeR} | R Documentation |
With a graph object of class
dgr_graph
, add a node prism to the graph.
add_prism(graph, n, type = NULL, label = TRUE, rel = NULL, nodes = NULL)
graph |
a graph object of class
|
n |
the number of nodes describing the shape
of the prism. For example, the triangonal prism has
|
type |
an optional string that describes the entity type for the nodes to be added. |
label |
either a vector object of length
|
rel |
an optional string for providing a relationship label to all new edges created in the node prism. |
nodes |
an optional vector of node IDs of
length |
a graph object of class dgr_graph
.
library(magrittr) # Create a new graph and add a prism graph <- create_graph() %>% add_prism(3, "prism") # Get node information from this graph node_info(graph) #> node label type deg indeg outdeg loops #> 1 1 1 prism 3 1 2 0 #> 2 2 2 prism 3 1 2 0 #> 3 3 3 prism 3 1 2 0 #> 4 4 4 prism 3 2 1 0 #> 5 5 5 prism 3 2 1 0 #> 6 6 6 prism 3 2 1 0