Generate co-occurrence matrix.