public class Dcs_dmperm {
/* breadth-first search for coarse decomposition (C0,C1,R1 or R0,R3,C3) */
private static boolean cs_bfs(Dcs A, int n, int[] wi, int[] wj, int[] queue, int[] imatch, int imatch_offset,
int[] jmatch, int jmatch_offset, int mark) {
int Ap[], Ai[], head = 0, tail = 0, j, i, p, j2;
Dcs C;
for (j = 0; j < n; j++) /* place all unmatched nodes in queue */
{
if (imatch[imatch_offset + j] >= 0)
continue; /* skip j if matched */
wj[j] = 0; /* j in set C0 (R0 if transpose) */