Learn R Programming

migraph (version 0.8.13)

to: Tools for reformatting networks, graphs, and matrices

Description

These functions offer tools for transforming certain properties of migraph-consistent objects (that is, matrices, igraph, tidygraph, or network objects).

Usage

to_unweighted(object, threshold = 1)

to_unnamed(object)

to_undirected(object)

to_onemode(object)

to_main_component(object)

to_uniplex(object, edge)

to_unsigned(object, keep = c("positive", "negative"))

to_simplex(object)

to_named(object)

to_multilevel(object)

Arguments

object

A matrix, {igraph} graph, {tidygraph} tbl_graph, or {network} object.

threshold

For a matrix, the threshold to binarise/dichotomise at.

edge

the name of an edge attribute to retain from a graph

keep

in the case of a signed network, whether to retain the "positive" or "negative" ties

Value

All to_ functions return an object of the same class as that provided. So passing it an igraph object will return an igraph object and passing it a network object will return a network object, with certain modifications as outlined below:

  • to_unweighted() returns an object that has all edge weights removed

  • to_unnamed() returns an object that has all vertex names removed

  • to_named() returns an object that has random vertex names added

  • to_undirected() returns an object that has any edge direction removed

  • to_onemode() returns an object that has any type/mode attributes removed, but otherwise includes all the same nodes and ties. Note that this is not the same as project_rows() or project_cols(), which return only some of the nodes and new ties established by coincidence.

  • to_main_component() returns an object that includes only the main component and not any smaller components or isolates

  • to_uniplex() returns an object that includes only a single type of tie

  • to_simplex() returns an object that has all loops or self-ties removed

  • to_unsigned() returns an object that has

Details

Since some modifications are easier to implement for some objects than others, here are the currently implemented modifications:

to_ edgelists matrices igraph tidygraph network
unweighted X X X X
undirected X X X X
unsigned X X
uniplex X X
unnamed X X X X X
named X X X X
simplex X X X
main_component X X X
onemode X X
multilevel X X X

See Also

Other manipulation: coercion, is(), project

Examples

Run this code
# NOT RUN {
to_unweighted(project_rows(southern_women))
to_unnamed(project_rows(southern_women))
to_undirected(ison_coleman)
to_onemode(ison_marvel_teams)
to_uniplex(ison_m182, "friend_tie")
to_unsigned(ison_marvel_relationships, "positive")
to_unsigned(ison_marvel_relationships, "negative")
to_simplex(ison_m182)
to_named(ison_m182)
to_multilevel(mpn_elite_usa_advice)
# }

Run the code above in your browser using DataLab