GitHub - mplex/multiplex: multiplex: algebraic tools for the analysis of multiple social networks (original) (raw)

CRAN version CRANdownloads

multiplex

Author: Antonio Rivero Ostoic (@mplex)

Abstract

Algebraic procedures for the analysis of multiple social networks are delivered withthis packageas described in Ostoic (2020) <DOI:10.18637/jss.v092.i11>.


Example: Partially Ordered Semigroup of Relations

create network data: two types of relations among three elements

set.seed(123) arr <- round( replace( array(runif(18), c(3,3,2)), array(runif(18), c(3,3,2))>.5, 3 ) )

dichotomize data with customized cutoff value

dichot(arr, c = 3)

string relations

strings(arr) strings(arr, equat = TRUE, k = 3)

create numerical or symbolic semigroup

semigroup(arr) semigroup(arr, type = "symbolic")

Green's relations of symbolic semigroup

semigroup(arr, type = "symbolic") |> green.rel()

create the partial order

strings(arr) |> partial.order(type = "strings")

plot partial order diagram

require("Rgraphviz", quietly = TRUE) strings(arr) |> partial.order(type = "strings") |> diagram(type = "hasse")

or equivalently:

plot hasse diagram of the partial order

require("Rgraphviz", quietly = TRUE) strings(arr) |> partial.order(type = "strings") |> hasse()


Example: Working with a Two-Mode Network data set

(taken from the multiplex vignette)

Fruits data

frt <- data.frame(yellow = c(0,1,0,0,1,0,0,0), green = c(0,0,1,0,0,0,0,1), red = c(1,0,0,1,0,0,0,0), orange = c(0,0,0,0,0,1,1,0), apple = c(1,1,1,1,0,0,0,0), citrus = c(0,0,0,0,1,1,1,1)) rownames(frt) <- c("PinkLady", "GrannySmith", "GoldenDelicious", "RedDelicious", "Lemon", "Orange", "Mandarin", "Lime")

Perform Galois connections among subsets with a reduced labeling

galois(frt, labeling = "reduced")

Get the partial order of these "concepts"

galois(frt, labeling = "reduced") |> partial.order(type = "galois")

Plot the concept lattice of the partial order

require("Rgraphviz", quietly = TRUE) galois(frt, labeling = "reduced") |> partial.order(type = "galois") |> diagram(type = "concept")