/* persons through groups example for Class 5 */ proc iml; /* the standard person to person network: 4.3 */ p4_3={0 0 0 1 0 0, 0 0 1 0 0 0, 0 1 0 1 0 0, 1 0 1 0 1 2, 0 0 0 1 0 1, 0 0 0 2 1 0}; G4_3={0 1 0 0 0, 1 0 1 1 1, 0 1 0 2 1, 0 1 2 0 1, 0 1 1 1 0}; mattrib g4_3 format=1.0; mattrib p4_3 format=1.0; Print p4_3 g4_3; A={0 0 0 0 1, 1 0 0 0 0, 1 1 0 0 0, 0 1 1 1 1, 0 0 1 0 0, 0 0 1 1 0}; AT=A`; mattrib A format=1.0; Mattrib At format=1.0; Print A AT; P=a*at; g=at*a; mattrib p format=1.0; mattrib g format=1.0; print p g; /* primary & Secondary groups: Breiger shows that you can build asymmetry into a graph by looking at primary and secondary groups. In this example, A is the standard person-to-group adjacency matrix and F is the matrix of primary group membership. As you can see the resulting graph is asymetric. Substantively, an arc is crated from primary group members to other members */ a={1 1 0, 0 1 1, 1 0 1, 1 0 1}; f={1 0 0, 0 1 0, 0 0 1, 0 0 0}; Pp=f*a`; mattrib pp format=1.0; print pp; quit;