57 idx_t ehead,
i, mdeg, mdlmt, mdeg_node, nextmd, num, tag;
63 xadj--; adjncy--; invp--; perm--; head--; qsize--; list--; marker--;
67 mmdint(neqns, xadj, adjncy, head, invp, perm, qsize, list, marker);
76 nextmd = invp[mdeg_node];
77 marker[mdeg_node] = maxint;
78 invp[mdeg_node] = -num;
92 while (head[mdeg] <= 0)
101 mdeg_node = head[mdeg];
102 while (mdeg_node <= 0) {
107 mdeg_node = head[mdeg];
111 nextmd = invp[mdeg_node];
114 perm[nextmd] = -mdeg;
115 invp[mdeg_node] = -num;
116 *ncsub += mdeg + qsize[mdeg_node] - 2;
117 if ((num+qsize[mdeg_node]) > neqns)
125 for (i = 1; i <= neqns; i++)
126 if (marker[i] < maxint)
130 mmdelm(mdeg_node, xadj, adjncy, head, invp, perm, qsize, list, marker, maxint, tag);
132 num += qsize[mdeg_node];
133 list[mdeg_node] = ehead;
143 mmdupd( ehead, neqns, xadj, adjncy, delta, &mdeg, head, invp, perm, qsize, list, marker, maxint, &tag);
147 mmdnum( neqns, perm, invp, qsize );
150 xadj++; adjncy++; invp++; perm++; head++; qsize++; list++; marker++;
174 idx_t element,
i, istop, istart,
j,
176 nabor, node, npv, nqnbrs, nxnode,
177 pvnode, rlmt, rloc, rnode, xqnbr;
181 marker[mdeg_node] = tag;
182 istart = xadj[mdeg_node];
183 istop = xadj[mdeg_node+1] - 1;
191 for ( i = istart; i <= istop; i++ ) {
193 if ( nabor == 0 )
break;
194 if ( marker[nabor] < tag ) {
196 if ( forward[nabor] < 0 ) {
197 list[nabor] = element;
200 adjncy[rloc] = nabor;
207 while ( element > 0 ) {
208 adjncy[rlmt] = -element;
213 jstop = xadj[link+1] - 1;
214 for ( j = jstart; j <= jstop; j++ ) {
217 if ( node < 0 )
goto n400;
218 if ( node == 0 )
break;
219 if ((marker[node]<tag)&&(forward[node]>=0)) {
222 while ( rloc >= rlmt ) {
223 link = -adjncy[rlmt];
225 rlmt = xadj[link+1] - 1;
231 element = list[element];
233 if ( rloc <= rlmt ) adjncy[rloc] = 0;
239 istop = xadj[link+1] - 1;
240 for ( i = istart; i <= istop; i++ ) {
243 if ( rnode < 0 )
goto n1100;
244 if ( rnode == 0 )
return;
247 pvnode = backward[rnode];
248 if (( pvnode != 0 ) && ( pvnode != (-maxint) )) {
250 nxnode = forward[rnode];
251 if ( nxnode > 0 ) backward[nxnode] = pvnode;
252 if ( pvnode > 0 ) forward[pvnode] = nxnode;
254 if ( pvnode < 0 ) head[npv] = nxnode;
258 jstart = xadj[rnode];
259 jstop = xadj[rnode+1] - 1;
261 for ( j = jstart; j <= jstop; j++ ) {
263 if ( nabor == 0 )
break;
264 if ( marker[nabor] < tag ) {
265 adjncy[xqnbr] = nabor;
271 nqnbrs = xqnbr - jstart;
274 qsize[mdeg_node] += qsize[rnode];
276 marker[rnode] = maxint;
277 forward[rnode] = -mdeg_node;
278 backward[rnode] = -maxint;
282 forward[rnode] = nqnbrs + 1;
284 adjncy[xqnbr] = mdeg_node;
286 if ( xqnbr <= jstop ) adjncy[xqnbr] = 0;
308 idx_t fnode, ndeg, node;
310 for ( node = 1; node <= neqns; node++ ) {
318 for ( node = 1; node <= neqns; node++ ) {
319 ndeg = xadj[node+1] - xadj[node];
323 forward[node] = fnode;
325 if ( fnode > 0 ) backward[fnode] = node;
326 backward[node] = -ndeg;
350 idx_t father, nextf, node, nqsize, num,
root;
352 for ( node = 1; node <= neqns; node++ ) {
353 nqsize = qsize[node];
354 if ( nqsize <= 0 ) perm[node] = invp[node];
355 if ( nqsize > 0 ) perm[node] = -invp[node];
359 for ( node = 1; node <= neqns; node++ ) {
360 if ( perm[node] <= 0 ) {
365 while ( perm[father] <= 0 )
366 father = - perm[father];
370 num = perm[
root] + 1;
376 nextf = - perm[father];
377 while ( nextf > 0 ) {
378 perm[father] = -
root;
380 nextf = -perm[father];
386 for ( node = 1; node <= neqns; node++ ) {
416 idx_t deg, deg0, element, enode, fnode,
i, iq2, istop,
417 istart,
j, jstop, jstart, link, mdeg0, mtag, nabor,
418 node, q2head, qxhead;
420 mdeg0 = *mdeg +
delta;
424 if ( element <= 0 )
return;
429 if ( mtag >= maxint ) {
431 for ( i = 1; i <= neqns; i++ )
432 if ( marker[i] < maxint ) marker[
i] = 0;
447 istop = xadj[link+1] - 1;
448 for ( i = istart; i <= istop; i++ ) {
451 if ( enode < 0 )
goto n400;
452 if ( enode == 0 )
break;
453 if ( qsize[enode] != 0 ) {
454 deg0 += qsize[enode];
455 marker[enode] = mtag;
458 if ( backward[enode] == 0 ) {
460 if ( forward[enode] != 2 ) {
461 list[enode] = qxhead;
464 list[enode] = q2head;
476 if ( enode <= 0 )
goto n1500;
477 if ( backward[enode] != 0 )
goto n2200;
482 istart = xadj[enode];
483 nabor = adjncy[istart];
484 if ( nabor == element ) nabor = adjncy[istart+1];
486 if ( forward[nabor] >= 0 ) {
496 istop = xadj[link+1] - 1;
497 for ( i = istart; i <= istop; i++ ) {
500 if ( node != enode ) {
501 if ( node < 0 )
goto n1000;
502 if ( node == 0 )
goto n2100;
503 if ( qsize[node] != 0 ) {
504 if ( marker[node] < *tag ) {
509 if ( backward[node] == 0 ) {
510 if ( forward[node] == 2 ) {
513 qsize[enode] += qsize[node];
515 marker[node] = maxint;
516 forward[node] = -enode;
517 backward[node] = -maxint;
520 if (backward[node]==0) backward[node] = -maxint;
534 n1600:
if ( enode <= 0 )
goto n2300;
535 if ( backward[enode] != 0 )
goto n2200;
540 istart = xadj[enode];
541 istop = xadj[enode+1] - 1;
542 for ( i = istart; i <= istop; i++ ) {
544 if ( nabor == 0 )
break;
545 if ( marker[nabor] < *tag ) {
546 marker[nabor] = *tag;
548 if ( forward[nabor] >= 0 )
556 jstop = xadj[link+1] - 1;
557 for ( j = jstart; j <= jstop; j++ ) {
560 if ( node < 0 )
goto n1700;
561 if ( node == 0 )
break;
562 if ( marker[node] < *tag ) {
574 deg = deg - qsize[enode] + 1;
576 forward[enode] = fnode;
577 backward[enode] = -deg;
578 if ( fnode > 0 ) backward[fnode] = enode;
580 if ( deg < *mdeg ) *mdeg = deg;
585 if ( iq2 == 1 )
goto n900;
591 element = list[element];
void genmmd(idx_t neqns, idx_t *xadj, idx_t *adjncy, idx_t *invp, idx_t *perm, idx_t delta, idx_t *head, idx_t *qsize, idx_t *list, idx_t *marker, idx_t maxint, idx_t *ncsub)
const mpreal root(const mpreal &x, unsigned long int k, mp_rnd_t r=mpreal::get_default_rnd())
idx_t idx_t idx_t idx_t idx_t * perm
void mmdelm(idx_t mdeg_node, idx_t *xadj, idx_t *adjncy, idx_t *head, idx_t *forward, idx_t *backward, idx_t *qsize, idx_t *list, idx_t *marker, idx_t maxint, idx_t tag)
EIGEN_DEVICE_FUNC SegmentReturnType head(Index n)
This is the const version of head(Index).
idx_t idx_t idx_t * adjncy
void mmdnum(idx_t neqns, idx_t *perm, idx_t *invp, idx_t *qsize)
void mmdupd(idx_t ehead, idx_t neqns, idx_t *xadj, idx_t *adjncy, idx_t delta, idx_t *mdeg, idx_t *head, idx_t *forward, idx_t *backward, idx_t *qsize, idx_t *list, idx_t *marker, idx_t maxint, idx_t *tag)
idx_t mmdint(idx_t neqns, idx_t *xadj, idx_t *adjncy, idx_t *head, idx_t *forward, idx_t *backward, idx_t *qsize, idx_t *list, idx_t *marker)