These functions offer tools for transforming migraph-consistent objects (matrices, igraph, tidygraph, or network objects). Transforming means that the returned object may have different dimensions than the original object.

to_mode1(object)

to_mode2(object)

to_main_component(object)

to_subgraph(object, ...)

to_ties(object)

to_blocks(object, membership, FUN = mean)

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

...

Arguments passed on to dplyr::filter

membership

A vector of partition memberships

FUN

A function for summarising block content. By default mean. Other recommended options include median, sum, min or max.

Details

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

to_edgelistsmatricesigraphtidygraphnetwork
mode1XXX
mode2XXX
main_componentXXX
subgraphXXXXX
tiesXXXXX
blocksXXXXX

Note that to_subgraph() returns a 'tidygraph' object, to_ties() returns an 'igraph' object, and to_blocks() returns a 'matrix' object.

Functions

  • to_mode1: Results in a weighted one-mode object that retains the row nodes from a two-mode object, and weights the ties between them on the basis of their joint ties to nodes in the second mode (columns)

  • to_mode2: Results in a weighted one-mode object that retains the column nodes from a two-mode object, and weights the ties between them on the basis of their joint ties to nodes in the first mode (rows).

  • to_main_component: Returns an object that includes only the main component without any smaller components or isolates

  • to_subgraph: Returns a network subgraph filtered on the basis of some node-related logical statement.

  • to_ties: Returns a matrix (named if possible) where the edges are the nodes

  • to_blocks: Returns a reduced graph from a given partition membership vector

See also

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

Examples

autographr(ison_southern_women) /
(autographr(to_mode1(ison_southern_women)) |
autographr(to_mode2(ison_southern_women)))

autographr(ison_adolescents) +  
autographr(to_ties(ison_adolescents))

(adolblock <- to_blocks(ison_adolescents, 
  node_regular_equivalence(ison_adolescents, k = 3)))
#>           Block 1 Block 2 Block 3
#> Block 1 0.1666667     0.5     0.5
#> Block 2 0.5000000     0.0     1.0
#> Block 3 0.5000000     1.0     0.0
autographr(adolblock)