"+"(e1, e2)
"-"(e1, e2)
"*"(e1, e2)
"%c%"(e1, e2)
"!"(e1)
"|"(e1, e2)
"&"(e1, e2)
network
. network
. %c%
), which must themselves be of equal size. Likewise, the bipartite
attributes of the inputs must match, and this is preserved in the output.
The unary operator acts per the above, but with a single input. Thus, the output network has the same properties as the input, with the exception of supplemental attributes.
The behavior of the composition operator, %c%
, is somewhat more complex than the others. In particular, it will return a bipartite network whenever either input network is bipartite or the vertex names of the two input networks do not match (or are missing). If both inputs are non-bipartite and have identical vertex names, the return value will have the same structure (but with loops). This behavior corresponds to the interpretation of the composition operator as counting walks on labeled sets of vertices.
Hypergraphs are not yet supported by these routines, but ultimately will be (as suggested by the above).
The specific operations carried out by these operators are generally self-explanatory in the non-multiplex case, but semantics in the latter circumstance bear elaboration. The following summarizes the behavior of each operator:
+
-
*
%c%
!
|
&
Semantics for missing-edge cases follow from the above, under the interpretation that edges with na==TRUE
are viewed as having an unknown state. Thus, for instance, x*y
with x
having 2 $(i,j)$ non-missing and 1 missing edge and y
having 3 respective non-missing and 2 missing edges will yield an output network with 6 non-missing and 9 missing $(i,j)$ edges.
Wasserman, S. and Faust, K. (1994). Social Network Analysis: Methods and Applications. Cambridge: University of Cambridge Press.
network.extraction
#Create an in-star
m<-matrix(0,6,6)
m[2:6,1]<-1
g<-network(m)
plot(g)
#Compose g with its transpose
gcgt<-g %c% (network(t(m)))
plot(gcgt)
gcgt
#Show the complement of g
!g
#Perform various arithmatic and logical operations
(g+gcgt)[,] == (g|gcgt)[,] #All TRUE
(g-gcgt)[,] == (g&(!(gcgt)))[,]
(g*gcgt)[,] == (g&gcgt)[,]
Run the code above in your browser using DataLab