Learn R Programming

migraph (version 0.8.13)

add: Adding and copying attributes from one graph to another

Description

Adding and copying attributes from one graph to another

Usage

add_node_attributes(object, attr_name, vector)

add_edge_attributes(object, object2)

copy_node_attributes(object, object2)

mutate_edges(object, object2, attr_name)

Arguments

object

A migraph-consistent object.

attr_name

Name of the new attribute in the resulting object.

vector

A vector of values for the new attribute.

object2

A second object to copy nodes or edges from.

Examples

Run this code
# NOT RUN {
add_node_attributes(mpn_elite_mex, "wealth", 1:11)
add_node_attributes(mpn_elite_usa_advice, "wealth", 1:14)
autographr(mpn_elite_mex)
both <- mutate_edges(mpn_elite_mex, generate_random(mpn_elite_mex), "random")
autographr(both)
random <- to_uniplex(both, "random")
autographr(random)
autographr(to_uniplex(both, "orig"))
# }

Run the code above in your browser using DataLab