Learn R Programming

migraph (version 0.10.6)

grab: Grab various node or edge attributes from a network

Description

These functions operate to help extract certain attributes from given network data. They are also useful as helpers within other functions.

graph_*() functions always relate to the overall graph or network, usually returning a scalar. node_*() and tie_*() always return vectors the same length as the number of nodes or edges in the network, respectively.

Usage

node_names(object)

node_mode(object)

node_attribute(object, attribute)

tie_attribute(object, attribute)

tie_weights(object)

tie_signs(object)

graph_nodes(object)

graph_ties(object)

graph_dims(object)

graph_node_attributes(object)

graph_tie_attributes(object)

Arguments

object

An object of a migraph-consistent class:

  • matrix (adjacency or incidence) from {base} R

  • edgelist, a data frame from {base} R or tibble from {tibble}

  • igraph, from the {igraph} package

  • network, from the {network} package

  • tbl_graph, from the {tidygraph} package

attribute

Character string naming an attribute in the object.

Functions

  • node_names: Extracts the names of the nodes in a network.

  • node_mode: Extracts the mode of the nodes in a network.

  • node_attribute: Extracts an attribute's values for the nodes in a network.

  • tie_attribute: Extracts an attribute's values for the edges in a network.

  • tie_weights: Extracts the weights of the edges in a network.

  • tie_signs: Extracts the signs of the edges in a network.

  • graph_nodes: Returns the total number of nodes (of any mode) in a network.

  • graph_ties: Returns the number of edges in a network.

  • graph_dims: Returns the dimensions of a network in a vector as long as the number of modes in the network.

  • graph_node_attributes: Returns a vector of nodal attributes in a network

  • graph_tie_attributes: Returns a vector of edge attributes in a network

See Also

Other manipulations: add, as(), reformat, transform()

Examples

Run this code
node_names(mpn_elite_usa_advice)
node_mode(mpn_elite_usa_advice)
node_attribute(mpn_elite_mex, "full_name")
tie_attribute(ison_algebra, "task_tie")
tie_weights(to_mode1(ison_southern_women))
tie_signs(ison_marvel_relationships)
graph_nodes(ison_southern_women)
graph_ties(ison_southern_women)
graph_dims(ison_southern_women)
graph_dims(to_mode1(ison_southern_women))
graph_node_attributes(mpn_elite_mex)
graph_tie_attributes(mpn_elite_mex)

Run the code above in your browser using DataLab