
150 CHAPTER 5. SHARED-MEMORY: C
5.9.1.1 The Code
// MutInl inks . cpp
// mutual in−l i n k s p r e v al e n c e computation
// i nput i s a graph adjacency matrix , element ( i , j )
// b eing 1 or 0 , depending on whether t h e r e i s an
// edge from v e rt e x i to v er t e x j
// we f i n d the t o t a l number o f mutual in−l i n k s , over
// a l l p o s s i b l e p a i r s o f v e r t i c e s
#include <Rcpp . h>
#include <omp. h>
// count number o f mutual i n l i n k s among v e r t i c e s
// j > i with v e rt e x i , i n the matrix xa o f type
// Rcpp : : NumericMatrix
int do one i ( Rcpp : : NumericMatrix xa , int i )
{
int nr = xa . nrow ( ) ;