Package 'multinets'

Title: Multilevel Networks Analysis
Description: Analyze multilevel networks as described in Lazega et al (2008) <doi:10.1016/j.socnet.2008.02.001> and in Lazega and Snijders (2016, ISBN:978-3-319-24520-1). The package was developed essentially as an extension to 'igraph'.
Authors: Neylson Crepalde [aut, cre]
Maintainer: Neylson Crepalde <[email protected]>
License: GPL-3
Version: 0.2.2.9000
Built: 2025-03-08 04:46:53 UTC
Source: https://github.com/neylsoncrepalde/multinets

Help Index


Extract the high level of a multilevel network

Description

Extract one of the three levels of a multilevel network. extract_highlevel will extract the higher level vertices and the edges between them, extract_lowlevel will extract the lower level vertices and the edges between them. On the other hand, extract_mesolevel will extract all the vertices but only the edges between vertices from different levels.

Usage

extract_highlevel(x)

Arguments

x

a graph object. Must be a multilevel network.

Value

extract_highlevel and extract_lowlevel return a 1-mode network. All the vertices in the selected level and the edges between them. extract_mesolevel returns a bipartite (2-mode) network. All the vertices are kept. Only edges between vertices of different levels are kept. This is what the literature also calls an affiliation network.

Author(s)

Neylson Crepalde, [email protected]

Examples

organizations <- extract_highlevel(linked_sim)

individuals <- extract_lowlevel(linked_sim)

affiliations <- extract_mesolevel(linked_sim)

Extract the low level of a multilevel network

Description

Extract one of the three levels of a multilevel network. extract_highlevel will extract the higher level vertices and the edges between them, extract_lowlevel will extract the lower level vertices and the edges between them. On the other hand, extract_mesolevel will extract all the vertices but only the edges between vertices from different levels.

Usage

extract_lowlevel(x)

Arguments

x

a graph object. Must be a multilevel network.

Value

extract_highlevel and extract_lowlevel return a 1-mode network. All the vertices in the selected level and the edges between them. extract_mesolevel returns a bipartite (2-mode) network. All the vertices are kept. Only edges between vertices of different levels are kept. This is what the literature also calls an affiliation network.

Author(s)

Neylson Crepalde, [email protected]

Examples

organizations <- extract_highlevel(linked_sim)

individuals <- extract_lowlevel(linked_sim)

affiliations <- extract_mesolevel(linked_sim)

Extract the meso level of a multilevel network

Description

Extract one of the three levels of a multilevel network. extract_highlevel will extract the higher level vertices and the edges between them, extract_lowlevel will extract the lower level vertices and the edges between them. On the other hand, extract_mesolevel will extract all the vertices but only the edges between vertices from different levels.

Usage

extract_mesolevel(x)

Arguments

x

a graph object. Must be a multilevel network.

Value

extract_highlevel and extract_lowlevel return a 1-mode network. All the vertices in the selected level and the edges between them. extract_mesolevel returns a bipartite (2-mode) network. All the vertices are kept. Only edges between vertices of different levels are kept. This is what the literature also calls an affiliation network.

Author(s)

Neylson Crepalde, [email protected]

Examples

organizations <- extract_highlevel(linked_sim)

individuals <- extract_lowlevel(linked_sim)

affiliations <- extract_mesolevel(linked_sim)

Check whether a graph is multilevel

Description

Checks whether a network (a graph) is multilevel according to the linked design proposed by Lazega et al (2008).

Usage

is_multilevel(x)

Arguments

x

A graph object.

Details

A multilevel network can be defined as a network with two kinds of vertex and two kinds of edges: Vertices on the lower level are, usually, individuals. Vertices on the higher level are, usually, organizations, collectivities or other kinds of social joint structures. The first kind of edges are those between the vertices of the higher level and between the vertices of the lower level. The second kind of edges are those between the vertices of different levels (affiliation ties).

Put another way, a multilevel network is a bipartite network (2-mode) that has ties between nodes on both levels.

Author(s)

Neylson Crepalde, [email protected]

References

Lazega, E., Jourda, M. T., Mounier, L., & Stofer, R. (2008). Catching up with big fish in the big pond? Multi-level network analysis through linked design. Social Networks, 30(2), 159-176.

Lazega, E. and Snijders, Tom A.B. (eds) (2016), Multilevel Network Analysis for the Social Sciences: Theory, Methods and Applications, Springer, Methodos Series.

See Also

is_bipartite

Examples

is_multilevel(linked_sim)

Layout for multilevel networks

Description

Set layout coordinates for multilevel networks from a chosen algorithm

Usage

layout_multilevel(x, layout = igraph::layout_with_fr)

Arguments

x

a graph object. Must be a multilevel network.

layout

The chosen layout algorithm. A function layout of the 'igraph' package without parentheses. Default set to 'Fruchterman-Reingold'.

Details

In order to facilitate the visualization of multilevel networks, higher level nodes are set in the upper part of the plane and the lower level nodes are set in the lower part of the plane.

Value

A two- or three-column matrix, each row giving the coordinates of a vertex, according to the ids of the vertex ids.

Author(s)

Neylson Crepalde, [email protected]

See Also

layout_

Examples

# Check if the network is multilevel
is_multilevel(linked_sim)

# Generate the layout (x,y) coordinates
l <- layout_multilevel(linked_sim)

# Plot the graph using the layout
plot(linked_sim, layout = l)

# Using Kamada Kawai algorithm
l.kk <- layout_multilevel(linked_sim, layout = igraph::layout_with_kk)

# Plot the graph with the new layout
plot(linked_sim, layout = l.kk)

A simulated multilevel network

Description

A simulated multilevel network following the "linked design" as proposed by Lazega et al (2008).

Usage

linked_sim

linked_sim_matrix

linked_sim_type

Format

linked_sim is a graph object with 150 vertices and 600 edges. There is one vertex attribute "type" defining to which level each vertex belongs. FALSE means lower level and TRUE means higher level.

linked_sim_matrix is a matrix object that contains the adjacency matrix for the simulated network.

linked_sim_type is a logical vector containing each vertex type.

Author(s)

Neylson Crepalde, [email protected]

Source

Elaborated by the author.

References

Lazega, E., Jourda, M. T., Mounier, L., & Stofer, R. (2008). Catching up with big fish in the big pond? Multi-level network analysis through linked design. Social Networks, 30(2), 159-176.

Lazega, E. and Snijders, Tom A.B. (eds) (2016), Multilevel Network Analysis for the Social Sciences: Theory, Methods and Applications, Springer, Methodos Series.


2-mode to 1-mode transformation

Description

This function is a wrapper to the bipartite_projection function from the 'igraph' package. It transforms a bipartite (2-mode) network to two 1-mode networks. It is recommended to use it as an analysis tool for a bipartite network that was obtained from extract_mesolevel.

Usage

mode_transformation(x, which = c("both", "high", "low"))

Arguments

x

a bipartite graph object. Data must be bipartite and must not be multilevel

which

one of "both", "high" or "low". High indicates to do the transformation to the higher level. Low indicates to do the transformation to the lower level. Both returns a list with both networks.

Details

The function counts 1 edge when two vertices of the higher level share a vertex of the lower level and 1 edge when two vertices of the lower level are affiliated to the same vertex in the higher level.

Value

If which is set to "both" (default), returns a list with two generated networks. If which is set to "high" or "low", returns a graph object.

Author(s)

Neylson Crepalde, [email protected]

Examples

# First, extract the mesolevel of the multilevel network
affiliation <- extract_mesolevel(linked_sim)

# To obtain both transformed networks
transformed <- mode_transformation(affiliation)

# To obtain just one transformed network
high_transformed <- mode_transformation(affiliation, which = "high")

Set colors for levels of a multilevel network

Description

Set vertices and edges colors for a multilevel network. Default set to blue (higher level) and red (lower level).

Usage

set_color_multilevel(x, color.true = "blue", color.false = "red",
  V.alpha = 0.7, E.alpha = 0.7)

Arguments

x

a graph object. Must be a multilevel network.

color.true

a character. The color to be chosen for the higher level (attribute type set to TRUE).

color.false

a character. The color to be chosen for the lower level (attribute type set to FALSE).

V.alpha

numeric. The factor modifying the opacity alpha for the vertices; typically in [0,1].

E.alpha

numeric. The factor modifying the opacity alpha for the edges; typically in [0,1].

Value

A graph object. A multilevel network with an added color vertex attribute vector and a color edge attribute vector.

Author(s)

Neylson Crepalde, [email protected]

Examples

# Check whether a graph is multilevel
is_multilevel(linked_sim)

# Set the colors for each level
linked_sim <- set_color_multilevel(linked_sim)

Set shapes for levels of a multilevel network

Description

Set vertices shapes for a multilevel network. Default set to "square" (higher level) and "circle" (lower level).

Usage

set_shape_multilevel(x, shape.true = "square", shape.false = "circle")

Arguments

x

a graph object. Must be a multilevel network.

shape.true

a character. The shape to be chosen for the higher level (attribute type set to TRUE).

shape.false

a character. The shape to be chosen for the lower level (attribute type set to FALSE).

Value

A graph object. A multilevel network with an added shape vertex attribute vector.

Author(s)

Neylson Crepalde, [email protected]

Examples

# Check whether a graph is multilevel
is_multilevel(linked_sim)

# Set the shapes for each level
linked_sim <- set_shape_multilevel(linked_sim)