Algebraic analysis of multiple social networks with multiplex

\pkg{multiplex} is a computer program that provides algebraic tools for the analysis of multiple network structures within the \proglang{R} environment. Apart from the possibility to create and manipulate multivariate data representing multiplex, signed, and two-mode networks, this package offers a collection of functions that deal with algebraic systems ---such as the partially ordered semigroup, and balance or cluster semirings--- their decomposition, and the enumeration of bundle patterns occurring at different levels of the network. Moreover, through Galois derivations between families of the pairs of subsets in different domains it is possible to analyze affiliation networks with an algebraic approach. Visualization of multigraphs, different forms of bipartite graphs, inclusion lattices, Cayley graphs is supported as well with related packages.


Introduction
Social networks are sets of collective relations between different actors and the discipline that studies these types of systems is called "social network analysis" (Wasserman and Faust 1994). Multiple -hereafter multiplex-networks are special types of social systems where actors are connected at several levels such as people who have simultaneously business collaboration relations and informal friendship ties, or organizations that cooperate and compete at the same time, etc. Such arrangements are inherently complex due to the "relationships between relations", which represents a higher level of abstraction in the social structure, and we need distinctive methods to preserve the multiplicity of these ties in the analysis.
A fruitful methodological framework for the analysis of multiplex networks is provided by relational algebra (Pattison 1993;Degenne and Forsé 1999) with a number of algebraic objects that are able to represent different types of complex structures a defined social milieu.

arXiv:1911.13037v2 [cs.SI] 13 Feb 2020
One of the first computer programs to perform algebraic analyzes of social networks is found in ASNET, which is a suite of modules latter incorporated in PACNET (Pattison, Wasserman, Robins, and Kanfer 2000;Ardu 1995). Although one can definitely find several other packages to make specific types of analysis of network data in R, 1 at this time there are any active programs that focus specifically on multiplex network structures with algebraic approaches. In this sense, multiplex (Ostoic 2019b) is a computer package that delivers a collection of functions with algebraic procedures for the analysis of various kinds of multiplex networks within the R setting. Among other things, this package combines algebraic systems like the partially ordered semigroup or the semiring structure together with the relational bundles occurring in different types of multivariate network data sets. There is also an algebraic approach for dealing with two-mode networks that is made through Galois derivations between families of the pair of subsets. Moreover, in conjunction with multigraph (Ostoic 2019a), it is possible to visualize multiplex networks in the form of "multigraphs" or graphs having parallel edges, Cayley graphs and much more with the graphical possibilities of the built-in R libraries, particularly graphics.

Multiplex social networks
Humans are collective actors that are related to each other within a defined social system at different levels. The multiplicity inherent to the social relations makes the social system a complex structure that is operationalized through the concept of "multiplex social network" (Boorman and White 1976;Breiger and Pattison 1986;Lazega and Pattison 1999) for the analysis. In formal terms, a social network X is a setting of n social entities N = {i | i is an entity, for i = 1, 2, . . . , n} measured under a collection of social ties R = {(i, j) | i 'has a tie to' j} where for individuals i, j ∈ X, X R (i, j) = 1 represents a tie R , and X R (i, j) = 0 denotes the lack of a tie between them. A network is directed when (i, j) is an ordered pair, and the pairs on X R are usually recorded in an adjacency matrix A with size n × n.
A multiplex network X combines a collection R of r different kinds of relations, R = {R 1 , R 2 , . . . , R r } measured over N . Each relational type is stored in a separate adjacency matrix A 1 , A 2 , . . . , A r , which are stacked together into a single array A with size n × n × r. This object resembles an adjacency tensor of a third order with n horizontal and vertical slices, and r frontal slices. Wasserman and Faust (1994) provide a comprehensive set of methods for the study of social networks including multiplex structures, whereas Pattison (1993) makes an exhaustive treatment of algebraic approaches to analyze both complete and local networks, the latter are structures emerging from individual actors. A more specific review on multiplex networks and other types of complex structures is found in Kivelä et al. (2014), whereas De Domenico et al. (2013) provide mathematical foundations of multilayer structures that is applicable to multiplex networks as well.

Multiplex network structure
To illustrate some algebraic analyzes, we take an example of a multiple network structure named "Incubator C". The object below called incubC (available in multiplex) represents empirically collected social relations of different types between actors in a closed setting (cf. Ostoic (2013) for details). The utils function str display the structure of this object and we can see that there are different components that follow the metacharacter $. The arrays of adjacency matrices of individual relations are recorded in net, whereas vector atnet indicates those arrays that represent attributes. Component IM allocates arrays corresponding to image matrices of aggregated role relations in net.  The whole network is depicted in Figure 1 as a graph with parallel edges with a force directed algorithm (Eades 1984;Fruchterman and Reingold 1991) implemented in multigraph for the visualization. The function multigraph allows us to specify a number of arguments within R both for nodes and for different types of edges representing actors and ties, respectively. R> library("multigraph") R> scp <-list(cex = 3, vcol = 8, bwd = .5, pos = 0, fsize = 7) R> multigraph(incC, layout = "force", seed = 123, scope = scp)

Link generalizations
Besides the "social structure", which is a system of relations between the actors in the network, a significant characteristic of multiplex networks is that there is also the structure produced by the relations among the relationships themselves. This kind of arrangement constitutes the network "relational structure" (Pattison 1993) and represents the intertwining of the different types of ties occurring in the system. Because of the complexity inherent in this type of arrangement, the analysis and substantial interpretation of the network relational structure and the social system in particular often constitute a great challenge.
Certainly, one approach to deal with such complexity is to reduce the network structure, and there are diverse techniques within the field of blockmodeling that produce classes of structurally related actors. However, most of the blockmodeling methods are based on the actors' embeddedness in the network, which is typically grounded on a single type of relationship (see Lorrain and White 1971;Doreian, Batagelj, and Ferligoj 2004, for significant examples). For multiplex networks, there is a significant loss of structural information in case the condensed system fails to reflect the multiplicity of the ties. Hence, it is desirable to produce a simpler and single structure that integrates the different types of relations, and at the same time provides valuable insights of the whole system for its substantial interpretation.
Integrating relations in multiplex networks implies a form of generalization of the links between pairs of actors in the system, and we recognize the multiplicity of the ties in the social structure either at the different levels in the relationship or by considering chains of several kinds of relations that influence the structuring process of the social system. The former is regarded as a "wide" extension of the pairwise link, whereas the latter generalization constitutes a "long" extension of the link.
The wide extension of the ties is expressed in different classes of configurations that occur at the dyadic level in the network structure and we call them "bundles". Such categories include the well-known patterns for single networks like the null, asymmetric, and reciprocal dyads (Holland and Leinhardt 1976), but also other arrangements that have the multiplexity property, which generalize these kinds of dyadic relations. The entrainment and the exchange of ties in directed networks are fundamental patterns where at least two types of tie are involved and, although there are bundle configurations where these patterns are mixed as well, these two configurations represent entirely different realities with consequences in the structural analyzes of social phenomena in multiplex network structures.
With respect to the long extension of the link, this form of generalization corresponds to the interrelations among the ties that produce chains and paths of relations. In this sense, simple ties such as social interactions, flow of information, co-occurrence, etc. constitute primitive relations in the system whereas the concatenation of these create compound relations. "Strings" is a generic name for both primitives and compounds, and string relations are known metaphorically as "words" composed by primitives or letters from an alphabet. Even though it is likely to have an infinite number of string relations, most of them will connect precisely the same individuals and as a result, there are a limited number of isomorphic strings in the closed system that stands for the network relational structure.

Relational bundles
For multiplex network structures, the wide component of the link is expressed in different types of bundle patterns, which are configurations at the dyadic level that encode the simultaneity of the various kinds of tie. The entrainment and the exchange of ties represent two fundamental classes with the multiplexity property, and these bundle patterns are extensions of the asymmetric and reciprocal dyad, respectively.
Formally, these classes are defined for an ordered pair of actors (i, j) ∈ R r as: Hence, while tie entrainment has an asymmetric character, the exchange of ties of different type implies -as the reciprocal dyad-that the bundle pattern has a mutual character. Besides, the mixture of an asymmetric and a reciprocal dyad represents another bundle class presumably with a mutual character, but that depends on the relational content of the ties. The  definition of the asymmetric and the reciprocal dyads in this case implies that the remaining levels in the relationship (if any) are null.
To perform the bundle census or the enumeration of the bundle patterns occurring in multiplex networks, multiplex has function bundle.census, and we apply it to object netC that records the social relations in component net of incC. Likewise, functions bundles and summaryBundles provide a more detailed information of the bundle patterns that exist in the network. The output from the code below produces a picture given in Figure 2 where the dimnames attribute of each array in netC (i.e., C, F, and K) serves to denote the type of tie involved in the bundle with an arc on the top indicating the direction of the tie between the actors.

Relational systems of bundle classes
The information provided by the different bundle classes allows us to evaluate the characteristic structure of the multiplex network, which is the basis for distinguishing particular "systems" inside the network for the developing of specific theories. For this, the bonds argument in function rel.sys allows us to disentangle bundle patterns or classes of them that are "bonds". For instance, we identify just the tie exchange bundle occurring in netC (cf. Fig. 1), which is recorded in component Ties of the output.
R> rel.sys(netC, type = "tolist", bonds = "txch")$Ties Because of its compactness, each type of relation is characterized by a vector with a "list of pairwise relations" rather than stacked adjacency matrices. By switching the type argument from "tolist" into "toarray" (or "toarray" for 2-mode data), it is possible to select particular bundle classes, and below is an example to identify the tie entrainment patterns in this particular network.
R> rel.sys(netC, type = "toarray", bonds = "tent") A system of strong bonds of the network is obtained either with a specific command or by selecting the bundle types with a mutual character. These are the reciprocals, tie exchange, and the mixed patterns occurring in the network. Likewise, a system made of weak bonds comprise bundle patterns with an asymmetric character that typically characterizes hierarchical structures; that is, asymmetric dyads and tie entrainment bundles.
However, what establishes the character of the bundle patterns is the relational content, and the categorization of social ties made by Tönnies (1940) as "affective" and "instrumental" (or Gemeinschaft and Gesellschaft in his original formulation) can provide some clues toward a topology of relational bundles. While the entrainment of any category of ties would produce an asymmetric pattern, the exchange of only affective or just instrumental positively valuated ties would yield in a mutual character. Yet the altercation of different categories of ties would not necessarily be a mutual bundle, since the relational content of the ties at the end may suggest a different story.
R> identical( + rel.sys(netC, type = "toarray", bonds = c("recp", "txch", "mixd")), + rel.sys(netC, type = "toarray", bonds = "strong") ) [1] TRUE Bundle patterns are important building blocks for creating theories in multiplex social networks. For instance, the visualization of the strong bonds system corresponding to netC as an undirected multigraph (not shown here) is possible with the ties of rel.sys in the code below, and we will notice that all bundles with a mutual character are occurring in the same component of the entire network. It is then possible from such arrangement to make a substantial interpretation of the complex structure, and a social influence process through direct contacts -for example-is more likely to happen just within this part of the network.

Statistical approach to bundle patterns
Bundle patterns allow us modeling structural features of multiplex network structures in stochastic terms. For instance, Wasserman (1980) proposed a simple stochastic model for measuring both the level of "cohesion" and "reciprocity" in a simple network that is based on the three dyadic parameters studied by Holland and Leinhardt (1981).
The maximum likelihood estimate for group cohesion is the proportion of asymmetric dyads in the network, A, to twice the amount of null dyads, N (cf. also Proctor and Loomis 1951). That is, where A = (i, j) ∈ R ∧ (j, i) / ∈ R, and N = (i, j) / ∈ R ∧ (j, i) / ∈ R, for i > j and r = 1.
The reciprocity level in the network is defined by the log odds of the ratio of group "coherence", which is the proportion of twice the mutual dyads M and asymmetric patterns, to the score for group cohesion. This is the log odds ratio Since weak and strong bonds generalize asymmetric and reciprocal dyads, respectively, the estimation of group cohesion and the reciprocity level in multiplex network structures is straightforward by counting in the bundle census the amount of strong and weak bonds: where the amount of null bundles in the proportion for cohesion for a network of n actors equals # null bundles = n 2 − # strong and weak bonds.

Semigroup of relations
While the wide extension to the link corresponds to the bundle patterns with a multiple character, the long extension is expressed algebraically by the concatenation of the existing ties in the network. The algebraic object "semigroup" serves to represent the logic of interlock of network relations, which are the links among simple and concatenated ties.
Formally, the semigroup of relations is made of a set of elements S of string relations together with an endowed operation '•' to the set corresponding to the concatenation of ties:

S, •
Each semigroup S is closed under the operation, which means that the product of two or more elements in S must be part of the semigroup. The concatenation of ties is a binary operation on an ordered pair • : S × S → S, that for all x, y, z ∈ S satisfies the Associative The Zermelo-Fraenkel Axiom of Extensionality, which is paraphrased as the "Axiom of Quality" by Boorman and White (1976), ensures that the semigroup is limited to a number of unique string relations, and this is because it equates the ties that link precisely the same individuals in the network: where ≤ is a partial order relation that is reflexive, transitive, and antisymmetric. The application of the Axiom of Quality makes possible that just some representative strings characterize S or the network relational structure. The partial order relation between a pair of representative strings R 1 ≤ R 2 exists iff relation R 2 contains relation R 1 ; that is, for all Diverse algebraic constrictions existing in the relational structure of the network is represented by the partially ordered semigroup (Pattison 1993), which is defined by the triple: that is, an abstract semigroup with a partial order among its elements where the semigroup is the product of the set of equations implicit in the string classes. On the other hand, the partial order structure or "poset" represents a hierarchy among pairwise disjointed subsets of string relations, which is another algebraic restriction. Later on, we will look at another kind of algebraic restriction that is based on the existing relations among the categories of strings, and which is produced by means of a decomposition of the semigroup structure.

Strings and equations
multiplex offers a suite of functions that allow processing abstract and partially ordered semigroups. To illustrate the semigroup construction, we "select" a small component in Incubator network C (cf. Fig. 1) with functions rel.sys and comps, and record the small component in object nCc.
R> nCc <-rel.sys(netC, type = "toarray", sel = comps(netC)$com [[3]]) Function strings provides the representative string relations in S -i.e., primitives and words if they exist-as a "Strings" class object. The output is given by taking the first element in a lexicographic order of a set of strings of those linking the same network members. For instance, the st component provides the labeling of the representative strings, ord indicates the order of S, whereas the "word tables" with the connections is given as arrays in wt.

R> strings(nCc)
$wt , , C 339 354 357 395 398 "F" "K" "CF" "FC" "FF" "CFF" "FCF" "FFC" [10] "FFF" "FCFF" "FFCF" "FFFC" "FFFF" "FFCFF" "FFFCF" "FFFCFF" attr(,"class") [1] "Strings" Once we know the unique elements of the semigroup a natural question arise, namely which are the strings that are equated to these representative relations? By activating the equat argument in this function, we apply the Axiom of Quality to the algebraic structure and produce the set of equations with the representative strings of the network relational structure. For this, k serves to establish the length of the compounds involved in the equations, and the attribute names of each vector in the list of component equat provides the representative string labels. In this case, only K is equated with all compounds until length 3.

Multiplication table and partial order
The interrelations among strings is expressed by the semigroup structure, and function semigroup produces the multiplication table of this algebraic structure in the S component of the output. The multiplication table can have either a "numerical" or a "symbolic" format, where the former (default) option assigns an integer to each string relation, whereas the symbolic representation assigns a label to each unique element of the semigroup that coincides with the output of the strings function. Both selections in semigroup produce a "Semigroup" class object that is required to perform the decomposition of S afterward.
On the other hand, function partial.order serves to establish the partial order structure of the semigroup provided that the type argument is set to "strings". In such case, the input data of the partial order function is of a "Strings" class object, and the output is an object "Partial.Order" of the type chosen class. Both the poset structure and the multiplication table then constitute partially ordered semigroup of the network relational structure.

Positional analysis and role structure
Even with a small network, the partially ordered semigroup of the social system is likely to become large and complex. Thus, rather than focusing on relational structures based on strings among the individual actors, one way to gain better insight into the relational interlock of a relative large real-world social network is first to construct the network positional system instead for. "Structurally equivalent" actors in the network who are meant to occupy the same "position" in the system make such arrangement, and in this way, we are able to reduce dramatically the size of the social system without losing its essential structure, which is a crucial feature for further analyzes and for the substantial interpretation of the network relational interlock. Since the actors in an alike position are meant to play a similar role in the social system, the relational structure of a positional system is called the role structure of the network.
A key aspect in network reduction is the definition of structurally equivalence among the actors. There are several meanings of structurally correspondence in social network analysis and it is outside the scope of this paper to look at the different definitions; however, it is important to mention that most of the equivalence notions are designed for simple networks with a "global" perspective, and some definitions are stricter criteria than others (see e.g., Lorrain and White 1971;Doreian et al. 2004, for widespread equivalence types). For multiplex networks, however, we need to take into account the multiplicity of the ties in the reduction of the network, and this can be achieved by means of a "local" perspective in the equivalence definition, i.e., the point of view of individual actors.
One correspondence type with a local perspective suitable for multiplex networks is local role equivalence (Winship and Mandel 1983), which is based on the role relations of the individual actors in the network and their respective role sets. This information is stored in a threedimensional array called Relation-Box, which is a device where the generators and compound relations of the network are bounded together. Because social actors are typically unaware of the long chains of relations surrounding them, the researcher can define a "truncated" version of the Relation-Box with composite ties until a certain length k.
Compositional equivalence Breiger and Pattison (1986) developed a correspondence type based on the local role equivalence since the establishment of roles and positions in the network is made with the perspectives of the individual actors, but considering also the relational features common to all network members. Specific standpoints are partial algebras operationalized in the form of "person hierarchies", which are then "cumulated" into a single poset structure where the partition of the network takes place. Due the compound relations provide substantial information for the establishment of the positional system, we refer to this correspondence type as Compositional equivalence, also known as "ego algebra" (Wasserman and Faust 1994).
Function rbox produces the Relation-Box of a given network as a "Rel.Box" class object, which is a three-dimensional array resembling the word tables given by the strings function but without applying the Axiom of Quality to the string relations. This means that none of the primitives nor the compounds are not equated with each other. A hierarchy among the network members is perceived by each actor according to their paths of relations, and this is obtained with the hierar function provided that the "person" option selected in the type argument. For instance, in the case of the first actor of network nCc the two options below are equivalent for producing this particular person hierarchy.
R> hierar(rbox(nCc), 1, type = "person") R> hierar(rbox(nCc), "339", type = "person") A significant aspect in the definition of compositionally equivalent actors is, however, the accumulation of the network partial algebras, which are represented in the horizontal slices in the Relation-Box, and which are called "relation planes". The rows in the relational planes record the collection of string relations for a distinguished individual actor, whereas the columns represent the actors' "role relations" that correspond to the ties of a particular kind to the rest of the actors in the system. The aggregation of person hierarchies is expressed by a poset structure known as the cumulated person hierarchy or CPH from the set of inclusion relations among relational planes after applying the transitive closure. Since CPH is a poset then the structure is reflexive, transitive, and antisymmetric.
Function cph serves to construct the cumulated person hierarchy, and relies on a "Rel.Box" object class as well. The following example shows the aggregation of the partial algebras in nCc based on the default length of ties in rbox, and the output for k = 3 shows that only two of the actors are comparable. The construction of the role structure as a partially ordered semigroup relies on the CPH with the chosen length of strings, and now we review the whole process of establishing the network positional system and role structure of an empirical network represented by Incubator C, netC. In this case the ties of the network are directed, and for digraphs is suggested to generate first "relational contrast" in the system, which is achieved by including the "tie transposes" in the construction of the Relation-Box. Thus, if relation C in the network represents "collaborates with," then the tie transpose will stand for "pointed as collaborator by." A similar construction occurs with the other kinds of tie occurring in the system.
To include tie transposes of the primitives in the construction of the Relation-Box, we activate the transp argument in the rbox function as with netCrb. This means that the CPH of this network in netCcph, which is based on the Relation-Box, reflects tie transposition as well. R> netCrb <-rbox(netC, transp = TRUE) R> netCcph <-cph(netCrb) With Compositional equivalence, structurally correspondent actors will have a similar set -or rather lack-of inclusions in the partial order structure, and visualizing the poset often provides useful insight for the partition of the network, especially when the structure is relatively large. Hence, with the convenient function diagram that uses the functionalities provided by the Rgraphviz package (Hansen et al. 2018) it is possible to plot the poset representing CPH as an inclusion lattice or "Hasse" diagram (Davey and Priestley 2002). Figure 3 shows the inclusion lattice of the CPH of Incubator C plotted with the two flavors available with the diagram function. The picture to the left includes all elements in the partial order structure, whereas the plot to the right is given without the "incomparable" elements in the poset, which is possible by disabling the incmp argument in the function.
As with many cases, there is no univocal solution in the network partition, and the researcher needs to make a judgment of the correspondence between actors that is based on theory or some other criteria. The simplest way of partitioning this particular network would be making two classes of actors, one with those who have an inclusion relation in the CPH, and another class with the incomparable actors. However, most of the times this is a trivial solution since it ends up with the identity and universal matrices, which either have none or an annihilating structuring effect in the role structure, and we need to differentiate equivalent actors who are linked in the inclusion lattice structure as well.
Based on the output from Fig. 3 we categorize the actors into three classes-one for the incomparable actors in the poset-and record this information as a vector in object cls.
R> cls <-c(2,3,3,3,2,1,3,3,3,3,2,3,2,2,1,2,2,3,3,3,2,1) where the class membership can be observed as: R> as. Function perm allows making a permutation of the matrix representing the cumulated person hierarchy with the clustering information allocated to the clu argument and we verify that actors 352, 391, and actor 414 (who covers the first one) clearly differentiate from the rest of the network members. Such differentiation is because these three actors contain the rest of the elements in the poset structure without being contained by them, and the output below involving the linked actors in the lattice structure serves as the basis for the network partition.

Algebraic constraints
Although it is possible to perform further partitions of the poset leading to a larger structure, a single-actor position seldom has a role in social life, and collective actors typically play social roles. Moreover, a large structure will usually -but not necessarily-produce a large semigroup of role relations, which is something we try to avoid in the first place. As a result, the clustering information used for the permutation of the CPH is applied in the reduction of the network by function reduc, which establishes the positional system of the network recorded in object netCps.
With directed multiplex networks, there are three kinds of algebraic constraints: One constitutes the "role table" representing the semigroup where the collective ties are interrelated. This structure is obtained with the semigroup function as well, but now with the network positional system as the generator relations gens in the semigroup.
R> netCps <-reduc(netC, clu = cls) R> netCS <-semigroup(netCps, type = "symbolic")  The Cayley colour graph or just Cayley graph is a graphical representation of the relationships among the relations in the network relational structure, which is given in this case as a semigroup of role relations with a symbolic format. Figure 4 depicts the Cayley graph of netCS, which is produced with the multigraph function ccgraph and the code below. Each generator is represented by a particular arc shape, and each representative string is represented by a node. We notice that there are two components, one for relation K, and the other for C and F; both with compounds product of "right multiplication".
R> scpc <-list(cex = 4, vcol = 8, lwd = 3, ecol = 1, fsize = 9, pos = 0) R> ccgraph(netCS, seed = 1, scope = scpc) Even though the representative strings in the role structure is given in component st of the output of the semigroup routine, once again we use function strings in the context of the network positional system to obtain the "set of equations", which is another algebraic constraint. We obtain the equations of strings until length 3 with the code below, and we observe for example in the output that one generator -namely Kis an idempotent element in the semigroup. In general, elements having the idempotence property are significant in finding subgroups in this algebraic system (Boyd 1991), which are more regular structures. The other equations occur just among compounds relations where FF is an idempotent element.
R> strings(netCps, equat = TRUE, k = 3)$equat $equat $equat$K [1] "K" "KK" "KKK" "KCK" "KFK" $equat$CC [1] "CC" "FC" "CCC" "FFC" "CCF" "FCC" "FCF" "CFC" "CKC" "FKC" $equat$CF [1] "CF" "CFF" $equat$CK [1] "CK" "FK" "CKK" "FKK" "CCK" "FFK" "CFK" "FCK" As seen before, the set of equations provides significant information when it comes to interpreting the hierarchy of the string relations, and this is because the poset structure is based on the unique strings computed with the strings function, as the objects netCst and netCpo reflect it. The depiction of partial order of the role structure is a convenient way to analyze the third algebraic constraint, namely the "hierarchy of role relations" of the network, which for Incubator C is depicted in Figure 5 as an inclusion lattice with the diagram function. In the inclusion lattice or Hasse diagram, the supremum role relations cover infimum elements labeled with the representative strings, and we notice in the poset of the role structure that the lattice structure has a compound and a primitive role as the maximal and the minimal elements, respectively.
R> netCpo <-partial.order(strings(netCps), type = "strings") R> diagram(netCpo) A substantial interpretation of these algebraic constraints states that if F represents an informal friendship role relation, and K perceived competition then are given within a formal collaboration network; that is, F ≤ C and K ≤ C. These role relations occur inside a structure where the friends' collaborators network, FC (and collaborators' collaborators, CC) that encompasses the arrangement of collaborators' friends, CF.
However, since the structure is not a lineal order the "friends of my friends" ties, FF occur within the formal-informal pattern "friends of my collaborators," CF (and "friends' friends of my collaborators," CFF), but not necessarily within the "collaborators of my competitors," KC and the other compounds equated to this pattern. A similar reading is applied to the rest of the strings in the hierarchy of role structure and the analysis of such role interlock for this particular network is made in a systematic way.
It is important to mention that since we included the transposition of the primitive ties, all these relations should be reflected in this arrangement as well. However, despite tie transpositions are not involved in the poset diagram just depicted, each of the inclusions involving C, F, and K is respected in the hierarchy of the role relations with transposes.
The role interlock of Incubator C has a set of univocal containments enclosing the generators and the equations of the shortest compounds, where the remaining four strings in the role structure are contained just in the two upper elements where the pair CFK ≤ FF contains CK, and the pair KF ≤ KC contains just the minimal element.

Decomposition
The last step in the analysis is to perform a decomposition of the semigroup of role relations, most of times by means of a "subdirect" representation. The decomposition process produces an "aggregated" role structure where string relations are clustered whenever they conform the rules of the "substitution property" (Hartmanis and Stearns 1966).
In the case of abstract semigroups, functions decomp and cngr perform the decomposition of semigroup structures, and below we generate the clustering of strings by means of congruence relations.
R> decomp(netCS, cngr(netCS, uniq = TRUE), type = "cc")$clu For partially ordered semigroups, the decomposition lies on the "factorization" of the semigroup structure (Pattison 1993), and this process has two parts. First, function fact produces the induced inclusions to the partial order, the atoms of the congruence lattice, and also the meet-complements of these atoms, whereas the second part of the decomposition is performed with the routine pi.rels that constructs the partition or π-relations for S.
Function decomp below activates the "mca" type option that stands for the "meet-complements of the atoms", and which are π-relations closer to the 1-element semigroup, which is the suprema or maximal element in the congruence lattice. It is also possible to perform the decomposition of S with other π-relations in the congruence lattice included the atoms, but the partitions closer to partial order, which is the infima or minimal element in the congruence lattice are "finer" than the π-relations closer to the suprema like the meet-complements.
R> decomp(netCS, pi.rels(fact(netCS, netCpo)), type = "mca")$clu Since both representations constitute a subdirect representation of the network role structure, we bear in mind again that these structures are partly overlapped to each other, even though we are confident at the same time that the output is a true representation of the relational structure.

Signed networks
A signed network is a special type of multiplex structure having particular types of relations among the actors with a different sign or valence. Signs of ties in signed networks are typically either "positive" or "negative" such as like and dislike, or collaboration and competition ties between companies or even nations; however, although the prototypical signed structures only have these two contrasting valences, real life social networks can have relationships in which both signs occur simultaneously. Hence, besides positive and negative ties, an "ambivalent" relation constitutes another kind of sign, whereas the "absence" of a tie between two actors is regarded as a valence as well.
There is a pair of functions in multiplex designed to represent systems with different valences. For example, the first and second matrices of object nCc from the previous section are by default considered as positive and negative ties in a given system by the signed function that produces a "Signed" class object. Because there is an entrainment of ties in this configuration, letters n a and o represent negative, ambivalent, and absent types of relations, respectively. In case that the second array of nCc represents p, then we explicit the positive ties in the input as below, and when the system has any ambivalent relation, then a positive and a negative integer and zero will represent the valence types in the signed network.

Structural balance and Semirings
Classical procedures designed for the analysis of signed networks try to find equilibrium -or lack of it-in network structures that are the product of the combination of ties with different signs. For instance, Simmel (1950) noticed that a conflict can be a mechanism of integration among social actors, and Heider (2013Heider ( , (1st edn. 1958) developed further on this idea with the Structural Balance theory, which sustains that imbalanced structures have an inherent tension and are prone to change, whereas balanced networks are more steady over time.
Roughly speaking, a strictly balanced system has two mutually exclusive groups of elements in which all within-ties are positive and all between-ties are negative. These rules of polarization, known as the Structure Theorem (Cartwright and Harary 1956), can be extended to more than two groups where a structurally balanced system has clusters of elements with positive within-ties and negative between-relations (cf. Davis 1967). This means that a signed network -besides being balanced or imbalanced-can be clusterable as well, which is a sort of structurally balanced structure as long these conditions apply.
The operationalization of the Structural Balance theory in signed networks is made with an algebraic approach, and in this case the rules of another algebraic system known as semiring serve to evaluate the network in terms of structural balance. A semiring is the combination of an abstract semigroup with identity under multiplication and a commutative monoid under addition, and in formal terms this structure is a quintuple: where Q is a non-empty set associated to the addition '+' and multiplication '·' operations together with a pair of special elements, 0 and 1, which are the neutral elements under addition and multiplication, respectively, and 0 acts as an absorbing element under multiplication as well. Besides, multiplication distributes over addition, which means that for x, y, z ∈ Q; x · (y + z) = (x · y) + (x · z) and (x + y) · z = (x · z) + (y · z).
Semirings are then going to be used for assessing whether a signed network is structurally balanced or not, and the evaluation is performed according to the two operations involved in this type of structure (cf. Harary, Norman, and Cartwright 1965). Basically, a chain of relations -whether directed or not-with an even number of positive edges is considered imbalanced; otherwise the chain is regarded as structurally balanced.
The semiring function of multiplex assesses signed structures in terms of either a "balance" or a "cluster" type semiring structure (See Doreian, Batagelj, and Ferligoj 2004, for details). With the base function formals we pay special attention to a number of the arguments of this function for a better understanding how it proceeds:

R> formals(semiring)
... $type c("balance", "cluster") Thus, once specifying one of the two type rules of the semiring structure, the argument symclos, which stands for "symmetric closure", serves to specify whether the evaluation is made in terms of paths or else by the default option that is chains or semipaths. Argument k states the length of these compounds, and controlling this interval is a decisive aspect in the assessment of the network in terms of the structural balance theory either with or without tie direction.

Checking for balance
We illustrate now the assessment process in terms of structural balance with the Incubator network C that is depicted in Fig. 1; however, since this network is made up of three types of relations we need to establish first the two contrasting relations. Collaboration ties and perceived competition among the actors seems to have opposite (or at least different) signs, and they will represent the positive and negative valences in the signed structure. This means that we disregard friendship relations for this part of the analysis, and the signed structure of Incubator network C is made of the C and K ties representing the positive and negative valences in the system. As a result, the first and third arrays representing the two kinds of ties in netC are then recorded in object netC2

R> netC2 <-netC[ , , c(1, 3)]
The signed network of netC2 is depicted as a multigraph in Figure 6 with the multigraph function and activating the signed argument to depict the positive and negative ties as solid and dotted arcs, respectively. In this case, we remove the isolated actors from these relation types, which is achieved by applying the rm.isol function to the network object.
R> multigraph(rm.isol(netC2), signed = TRUE, layout = "force", seed = 1, + scope = scp) First we notice that the system is disconnected and, since is not possible to have chains of relations between actors in different components of the network plus the dyadic component in the multigraph has a single positive tie, the analysis of structural balance focuses on the large component of this network where the two types of tie occur. Function comps allows listing the members in each of the components in the signed or any network plus the isolated actors, and such output is useful for the extraction of particular actors from the entire system.

$com $com[[1]]
[1] "368" "376" "380" "391" "394" "328" "407" "414" "342" "352" [1] "398" "357" $isol [1] "327" "331" "339" "354" "363" "366" "374" "393" "395" "406" Because the actors in netC2 bear labels, the construction of the signed structure is made by locating the members inside the first component of the network, and assigning such information into the vector sel below. The creation of the signed structure is made by applying the signed function to this particular array of selected elements that represents the large component of the network. The signed network is then recorded as a "Signed" class object in netCsg that accounts just for the involved actors in the large component with the collaboration and competition ties.
R> sel <-which(dimnames (netC2) As we can see in the first signed matrix above, there exists an ambivalent relation from actor 328 to actor 376, which means that the system cannot be strictly balanced when considering paths; i.e., it is not possible to have groups of actors with positive and negative ties only. Nevertheless, in the case of semipaths (second signed matrix) the symmetric closure of the network implies that such bundle pattern involving the ambivalent tie ends up having a positive sign, and this is due to the fact that with this operation a positive (and negative) valence prevails over the ambivalence, and any valence type has prevalence over absent relations.
The fact that the signed structure is structurally balanced implies that it is not prone to change from endogenous causes. However, the substantial implications of this resilience to change in a near future will depend on the relational content of the ties and in the context where the network of relations is taking place.

Cluster semiring
Another possibility of function semiring is to apply the "cluster" type option. The difference between this choice and balance semiring lies on the operation rules; cluster semiring namely handles as well an intermediate valence q that is the product of two negative signs (cf. Harary et al. 1965, andDoreian et al. (2004) for rules of cluster and balance semirings).
We evaluate next the signed network netCsg with the rules of the cluster semiring in order to obtain a stable arrangement, and by "stable" we mean that the semiring structure remains invariable with longer paths or chain relations. For instance, we verify that this algebraic structure considering paths with k = 4 and semipaths with k = 5 are identical, and hence we obtain the ending configuration to assess the network in terms of structural balance.
R> identical( + semiring(netCsg, type = "cluster", k = 4, symclos = FALSE)$Q, + semiring(netCsg, type = "cluster", k = 5, symclos = TRUE)$Q ) [1] TRUE As a result, the steady cluster semiring structure for this component is obtained with paths of length 4, and this is because systems product of cluster semiring with longer paths remain unchanged. In this case, the constant structure distinguishes a single actor from the system, namely actor 394 who is only connected through negative ties to the rest of the system. However, since a acts as the absorbing element within the addition operation both with the balance and the cluster semiring versions, this actor is ambivalent tied from the rest of the component either with the path or the semipath options. The fact that all incoming chains of ties in the semiring structure are ambivalent, except for the cycle and semicycle involving actor 394, suggests that the large component of Incubator network C is not structurally balanced as a clusterable system.
R> semiring(netCsg, type = "cluster", k = 4, symclos = FALSE)$Q The premise is that structurally balanced settings are expected to be more stable over time than imbalanced structures, and this allows supporting predictions e.g., about social influence processes through interpersonal relations. The presence of ambivalent ties prevent to have a structurally balanced structures, but it is still possible to find "factions" in a weakly balanced network of contrasting relations.

Affiliation networks
Social systems in which the "domain" and "co-domain" do not coincide constitute affiliation networks, which are also known as two-mode or bipartite networks, and this definition contrasts with the usual simple networks that are one-mode and in which there is just one set of relations on a single domain of nodes or social actors. Bipartite graphs are naturally the representation form of bipartite or affiliation networks where the distinctive of the graph is that nodes are differentiated in two modes.
On the other hand, the clustering information for the "events" is given before in ec, and it encodes the supranational organizations that are "bridges" from the two kinds of "assemblies" representing block interests.

Visualization of two-mode data
The clustering information in vectors ec and ac is then used in the visualization of the bipartite graph, and for this purpose, they need to be specified as a list object. Typically, bipartite graphs have two columns, one for each domain of the two-mode network; however, other options for the visualization are certainly possible. For instance, the multigraph function bmgraph with the code below plots in Figure 7 a bipartite graph with three columns where the actors are separated in different columns according to the clustering information given in cluc argument and the layout option "bipc". On the other hand, the last command plots in the same Figure the network as a graph with a forced directed algorithm using the binomial projection approach to two-mode data described in Borgatti (2012).
R> bmgraph(G20, layout = "bipc", clu = list(ac, ec), cex = 3) R> bmgraph(G20, layout = "force", seed = 321, vcol = 8, cex = 3, fsize = 8) The visualization of the data is an important step in the analysis of two-mode networks and both kinds of graphs show the countries distinct affinities with their memberships in their own manner. For instance, the force-directed layout clearly evidences some organizations that act as significant bridges between emergent and advances economies, while a bipartite graph typically relies on the given order of the elements in the object representing the network. In this case, however, there is a manual specification of the clustering, and it is worth mentioning that an increasing in the number of classes either in the domain or in the co-domain of the network implies an increasing in the number of columns in the graph with the "bipc" layout option of bmgraph.

Formal concept analysis
An algebraic approach for the analysis of affiliation networks is found in formal concept analysis (Ganter and Wille 1996). In terms of this analytical framework, the domain and co-domain of an affiliation network, respectively, are characterized as a set of objects G and a set of attributes M . A formal "context" is obtained with an incidence relation I ⊆ G × M between these sets, which is the triple represented by the cross table of the data frame. The formal "concept" of a formal context is a pair of sets of objects A and attributes B that is maximally contained on each other; i.e., columns in the cross table representing the attribute set that help to cover the most entries in I, where A and B are said to be the "extent" and "intent" of the formal concept respectively.
A Galois derivation between the power sets of sets G and M is derived for any subsets A ⊆ G and B ⊆ M by the set of attributes common to all the objects in the intent, A , and the set of objects possessing the attributes in the extent, B : where g and m are rows and columns in the derivation operation, and G and M result being two closed systems dually isomorphic to each other.
With multiplex, it is possible to obtain the Galois derivations between the objects and the attributes in a given context with the galois function that produces a "Galois" class object. For instance, a truncated output of these connections in the G20 data set is given below with the default "full" labeling argument of the elements in this formal context, and there are different sets of G elements in this class object recorded as a list data type where diverse sets of M are the attribute names of the items. We can see, for example, that this part of the output shows affiliations of the three organizations that are interest assemblies in the network and three bridge organizations. Moreover, the G7 countries are also members of DAC and OECD, and some of these countries are connected to the organizations previously derived.
R> galois(G20) Such output is not simply a set of elements, but actually constitutes a family of concepts where the order of the elements is significant. The galois function allows as well to obtain a "reduced" labeling of objects and attributes, which in most of the cases provides a more informative output. With this option, the repeated objects discard the previous ones, whereas the recurrent attributes in the listing are also discarded but afterward in the derivation.
The Galois connections of network G20 is given below with the reduced labeling, and such output is recorded in object G20gc for a later use. We bear in mind that the order of the concepts is the same as with the full labeling given earlier, and we evidence, for example, that in the third concept there is a single country that is related just to the three attributes of the full labeling without belonging to any other concept. However, two of the three organizations in this concept have other members (not printed here) and therefore their labels are located in concepts listed afterward the derivation.

Partial ordering of the concepts
In the previous example, recurrent objects in the family of concepts with reduced labeling discard the previous ones produced in the derivation. This implies that these latter objects are covered for the one printed in the output, and such type of relation applies to all objects, and dually to the attributes as well. Hence, the set of inclusions of the concepts serves to clarify the disposition of the Galois derivations in the formal context.
The partial ordering of the concepts is established as the hierarchy given by the relation subconcept-superconcept, (A 1 , B 1 ) and (A 2 , B 2 ), of extents and intents, which is formally expressed as: The set of formal concepts product of the Galois derivations in the formal context serves to establish the partial ordering of the concepts. For the G20 countries formal context, the ordering among the concepts is given in G20gc, which contains the full derivation of the objects and attributes even if is specified with a "reduced" labeling in the galois function.
To obtain the ordered structure of the Galois derivations of the formal concepts, we use the "galois" type argument in the function partial.order, which produces a "Partial.Order" class object that is a "galois" type as well. As said, although the reduced option is typically used for the representation of the inclusion structure, the hierarchy given in the partially ordered structure is based on the "full" labeling of the concepts is part of the output even though it is not printed on the screen with the reduced option. To have a better representation of the partial order structure, the lbs argument in the function allows customizing the names of the concepts in the context corresponding to the matrix labels.

Concept lattice of the context
By looking at the partial order table above, we can see for instance that concept 10 is contained by all elements of the structure, whereas concept 25 includes the rest of the concepts resulting from the Galois derivations. This means that the former concept constitutes the minimal element in the lattice and is covered by the rest of the concepts of the partial order structure, whereas the latter concept is the maximal element in the lattice and covers the rest of the elements in the poset. However, other inclusion relations may be difficult to observe with the matrix format and the visualization of the partially ordered structure of inclusions among formal concepts results most of times more informative.
The concept lattice of the formal context, aka Galois lattice in social network analysis, is established as a system of partially ordered elements corresponding to the set of all concepts. In this case, the greatest lower bound of the meet and the least upper bound of the join are defined in terms of objects and attributes and an index set T by the Basic Theorem of Concepts Lattices (Ganter and Wille 1996).
To create the partial order structure of the Galois connections among the concepts in formal context of the G20 affiliation network, we use the partial.order function with the appropriate type. The "dimnames" of the poset structure in object G20po reflects the labeling of the derivations used in the input, which in this case was specified with the reduced labeling, and the construction of the concept lattice through the diagram function lies on this information.
R> G20po <-partial.order(G20gc, type = "galois") R> diagram(G20po) Figure 8 depicts as a concept lattice the set of inclusions among the maximal rectangles in the formal context corresponding to the G20 countries and their affiliations and, since this is a reduced representation of the context, both objects and attributes are given just once as in the partial order structure. We notice that -contrary to the typical representation of a formal context-the labels of the concepts are placed instead of the nodes rather than next to them. When a concept does not have a label, which most of the times occurs in reduced contexts, then the respective number of the concept is placed instead the node rather than leaving it unlabeled as it happens with concepts 10, 19, 20, and 22.
In the concept lattice of the context, objects having more attributes are located downward and hence covered by the objects with less attributes; conversely, the reverse is true for the attributes, which means that the most popular ones are located more upward than the less popular attributes. This implies that the "levels" in the lattice somewhat tries to reflect the covering in the two instances. However, the placement of the elements in the lattice diagram corresponds to the layout algorithm applied by the Rgraphviz package, which can result rather arbitrary depending on the cases. In this case, although ZAF has fewer affiliations than ITA for instance, it is depicted in a lower level than the latter country (cf. Fig. 8), and to have a more precise information we need to count with the set of inclusion relations in the context lattice, particularly in lattice structures with a large number of concepts.

Order filters and order ideals
The construction of the concept lattice of the context allows us to gain significant information about the affiliation network, and one part of the lattice structure is concerned with the inclusion levels among the concepts. Another aspect deals with "downsets" and "upsets" that are implications made from all the lower and greater bounds of a given element in the line diagram. For relatively large formal contexts, however, the corresponding poset structure typically results in a too complex, and it is useful to count with the set of implications among objects and attributes in the concept lattice structure of any given formal context. Algebraic notions based on upsets and downsets are of fundamental importance in uncovering implication subsets in an ordered structure, and next we look at requires a formal definition of these theoretical concepts.
An ordered set is represented by the pair (P, ≤) where a and b are some elements in P . A non-empty subset U [resp. D] of P is an upset [resp. downset] called a order filter [resp.   For a specific element x ∈ P , the upset ↑ x formed for all the upper bounds of x is called a principal order filter generated by x. Dually, ↓ x is a principal order ideal with all the lower bounds of x. Order filters and order ideals not coinciding with P are called proper. In this sense, both order filters and order ideals of particular elements of the context are based on the partial ordering of the concepts.
Function fltr of multiplex allows finding these subsets of elements in the context lattice either with the label or with the number of the concept, which has been assigned according to the corresponding partial order structure. For example, the principal order filter set of the third element in the partial order structure of the Galois derivations of the concepts corresponding to the G20 affiliation network, which is obtained with the default option in this function. The output starts with the concept used as the input, and then continues with the different inclusions to this concept until the maximal element, and the numbering of the concepts according to the partial order table corresponds to the attribute names of the items of the list data type of the output.
R> fltr(3, G20po) Likewise, proper order ideals of one or more concepts are obtained with the same function provided that the ideal argument is activated in the input. In the next example, we employ the name of the intents of two concepts, which gives the affiliates of G7 and BRICS in the G20 network.
R> fltr(c("G7" , "BRICS"), G20po, ideal = TRUE) Although in this case the membership to the two organizations may be known in advance, order filters and order ideals are convenient ways to discover recurring sets of dependences amongst different types of formal concepts. Particularly for objects and attributes belonging to large affiliation networks and other complex systems with separate domains.

Discussion
multiplex is one of the first attempts to provide algebraic procedures for the analysis of complex network structures within the R environment, and this is despite the methodologies have been developed for some years ago. Algebraic analysis is characterized by its deterministic reasoning, and this constitutes a significant difference with the statistical approach. One advantage of statistics over algebra is that it can handle large amounts of information, whereas the benefit from an algebraic analysis of networks is that we have the certainty that the resulted structure is taken place somewhere in the system, and it is not merely a likelihood as with statistical inference.
Algebraic systems such as semigroups and semirings are aimed to relative small to medium size network structures, which constitutes a significant limitation in some cases. This also applies to Compositional equivalence since there is the risk that the accumulation of perceived hierarchies in the network ends up having no structure as the universal matrix, and instead of individuals, semigroups for instance are typically applied to role structures made of categories of actors. For larger networks, such categories may be produced with a model-fitting approach where a number of classes of hierarchical exponential-family random graph models for social networks constitute an alternative to the descriptive and are able to handle multiplex networks. A crucial step to obtain the logic of interlock in the network and algebraic constraints governing the relations among relations (such as set of equations, hierarchy of string relations, and role tables) is , however, the decomposition of the semigroup structure. multiplex can handle both abstract and partially ordered semigroups for decomposition.
With respect to algebraic approaches for signed structures, there is also a concern with the network size. Working with categories of actors is, again, a possibility for large networks, but this still is today a relative unexplored area for a potential research. One aspect worth to mention is that one can see balance and cluster semirings as fuzzy structures where the positive, negative, and ambivalent valences constitute the values in the fuzzy set, which can even be continuous in case the reduction of the valence structure produces in the image matrix relations with mixed signs among factions of differentiated actors.
Visualizing poset structures is especially convenient for deducing containments among elements in the partial ordering, and this applies both to partially ordered semigroups and to concept lattices of a given formal context. It is a very difficult task -if not impossible-just by looking at the array representing hierarchies of either string relations of multiplex networks, or of Galois derivations of formal concepts corresponding to affiliation networks. For large partially ordered structures, it may be necessary to apply the algebraic notions of order filters and order ideals to produce particular sets of inclusions, and this makes possible to elaborate substantial interpretations of the hierarchy of concepts in a systematic way, as the set of equations and role tables do for the relational interlock of multiplex network structures.
If possible, stochastic and algebraic analyzes should complement to each other in algebraic statistics, and the condensation of large network structures is likely to be made in statistical terms, leaving the algebra to make the more subtle examination of the reduced structure. In this sense, the integration of statistical and algebraic approaches constitutes a promising line of research within the structural analysis, and R provides an adequate setting to study and test novel structural methods and theoretical models with real world applications.