These functions extract certain attributes from given network data:

  • net_name() returns the name of the network, if it has one.

  • mode_names() returns a vector of the names of the modes in a network, if they have been defined.

  • net_node_attributes() returns a vector of nodal attributes in a network.

  • layer_names() returns a vector of the names of the layers in a network, if they have been defined.

  • layer_is_directed() returns whether each layer of a network is directed, named by layer.

  • net_tie_attributes() returns a vector of tie attributes in a network.

These functions are also often used as helpers within other functions.

net_name(.data, prefix = NULL)

mode_names(.data)

net_node_attributes(.data)

layer_names(.data)

layer_is_directed(.data, layer = NULL)

net_tie_attributes(.data)

Arguments

.data

An object of a {manynet}-consistent class:

  • adjacency or incidence matrix from {base} R

  • edgelist data.frame from {base} R or tbl/tbl_df from {tibble}

  • stocnet stocnet, from the {manynet} package

  • igraph igraph, from the {igraph} package

  • network network, from the {network} package

  • tidygraph tbl_graph, from the {tidygraph} package

prefix

An optional string to be added before the name of the network.

layer

An optional character string naming one of the layers, one of those returned by layer_names(). Where a layer is named, a single value is returned for that layer; otherwise a value is returned for every layer, named by layer.

Value

net_*() functions always relate to the overall graph or network, usually returning a scalar. net_*_attributes() returns a string vector with the names of all node or tie attributes in the network.

Details

A network can be directed in one layer and undirected in another, as a network of interstate trade and of state membership in intergovernmental organisations is. is_directed() marks such a network TRUE, since it holds arcs, and layer_is_directed() says which of its layers those arcs are in. Where a network records nothing about a layer, the network's own direction is reported for it.

Examples

net_name(ison_southern_women)
#> [1] "Southern Women Data"
  mode_names(ison_algebra)
#> NULL
  net_node_attributes(fict_lotr)
#> [1] "name" "Race"
  layer_names(ison_algebra)
#> [1] "social"  "tasks"   "friends"
  layer_is_directed(ison_algebra)
#>  social   tasks friends 
#>    TRUE    TRUE    TRUE 
  net_tie_attributes(ison_algebra)
#> [1] "type"   "weight"