2016-04-21 22:40:59 +00:00
|
|
|
Description: enable runtime detection of popcnt-enabled CPU
|
|
|
|
Origin: fedora
|
|
|
|
Author: Jerry James <loganjerry@gmail.com>
|
2021-09-02 20:09:07 +00:00
|
|
|
Last-Update: 2021-09-02
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
--- a/addedgeg.c
|
|
|
|
+++ b/addedgeg.c
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -74,6 +74,23 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
+STATIC_POPCNTFUNC(int,compute_degree,(const graph *g, int *deg, int m, int n),
|
|
|
|
+{
|
|
|
|
+ const setword *gv;
|
|
|
|
+ int v, actmaxdeg = 0;
|
|
|
|
+
|
|
|
|
+ for (v = 0, gv = g; v < n; ++v, gv += m)
|
|
|
|
+ {
|
|
|
|
+ int i, degv = 0;
|
|
|
|
+ for (i = 0; i < m; ++i)
|
|
|
|
+ degv += POPCOUNT(gv[i]);
|
|
|
|
+ if (degv > actmaxdeg) actmaxdeg = degv;
|
|
|
|
+ deg[v] = degv;
|
|
|
|
+ }
|
|
|
|
+ return actmaxdeg;
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+/*************************************************************************/
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -89,7 +106,7 @@
|
|
|
|
nauty_counter nin,nout;
|
|
|
|
char *arg,sw;
|
|
|
|
setword *gv,*gw;
|
|
|
|
- int maxdeg,actmaxdeg,degv;
|
|
|
|
+ int maxdeg,actmaxdeg;
|
|
|
|
double t;
|
2016-04-21 22:40:59 +00:00
|
|
|
#if MAXN
|
2022-11-17 20:47:11 +00:00
|
|
|
graph h[MAXN*MAXM];
|
|
|
|
@@ -208,16 +225,7 @@
|
|
|
|
DYNALLOC1(int,dist,dist_sz,n,"addedgeg");
|
2016-04-21 22:40:59 +00:00
|
|
|
#endif
|
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
- actmaxdeg = n;
|
|
|
|
- for (v = 0, gv = g; v < n; ++v, gv += m)
|
|
|
|
- {
|
|
|
|
- degv = 0;
|
|
|
|
- for (i = 0; i < m; ++i)
|
|
|
|
- degv += POPCOUNT(gv[i]);
|
|
|
|
- if (degv < actmaxdeg) actmaxdeg = degv;
|
|
|
|
- deg[v] = degv;
|
|
|
|
- }
|
2016-04-21 22:40:59 +00:00
|
|
|
-
|
2022-11-17 20:47:11 +00:00
|
|
|
+ actmaxdeg = compute_degree(g, deg, m, n);
|
|
|
|
if (actmaxdeg > maxdeg) continue;
|
2016-04-21 22:40:59 +00:00
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
okdist[0] = okdist[1] = FALSE;
|
2016-04-21 22:40:59 +00:00
|
|
|
--- a/complg.c
|
|
|
|
+++ b/complg.c
|
2020-06-02 14:48:24 +00:00
|
|
|
@@ -51,6 +51,17 @@ compl(graph *g, int m, int n, graph *h,
|
2016-04-21 22:40:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+/*************************************************************************/
|
|
|
|
+STATIC_POPCNTFUNC(size_t __attribute__((pure)),num_edges,
|
|
|
|
+ (const graph *g, size_t gwords),
|
|
|
|
+{
|
|
|
|
+ size_t ii, ned;
|
|
|
|
+
|
|
|
|
+ ned = 0;
|
|
|
|
+ for (ii = 0; ii < gwords; ++ii) ned += POPCOUNT(g[ii]);
|
|
|
|
+ return ned;
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
int
|
2020-06-02 14:48:24 +00:00
|
|
|
@@ -175,10 +186,10 @@ main(int argc, char *argv[])
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
if (restricted || Restricted)
|
|
|
|
{
|
|
|
|
- ned = loops = 0;
|
|
|
|
+ loops = 0;
|
|
|
|
gwords = m * (size_t)n;
|
|
|
|
nn = n * (size_t)(n-1);
|
|
|
|
- for (ii = 0; ii < gwords; ++ii) ned += POPCOUNT(g[ii]);
|
|
|
|
+ ned = num_edges(g, gwords);
|
|
|
|
for (ii = 0; ii < n; ++ii) if (ISELEMENT(g+m*ii,ii)) ++loops;
|
|
|
|
if (Lswitch)
|
|
|
|
{
|
|
|
|
--- a/configure.ac
|
|
|
|
+++ b/configure.ac
|
2021-09-02 20:09:07 +00:00
|
|
|
@@ -79,6 +79,9 @@ AC_ARG_ENABLE([popcnt],
|
2020-06-02 14:48:24 +00:00
|
|
|
AS_HELP_STRING([--disable-popcnt], [Disable popcnt extensions]),
|
|
|
|
[enablearg=given], [enablearg=notgiven])
|
|
|
|
AS_IF([test $enablearg = notgiven || test "x$enable_popcnt" = xyes],[allow_popcnt=1],[allow_popcnt=0])
|
2016-04-21 22:40:59 +00:00
|
|
|
+AC_ARG_ENABLE([runtime-popcnt],
|
|
|
|
+ AS_HELP_STRING([--enable-runtime-popcnt], [Detect popcnt extensions at runtime]),
|
|
|
|
+ [runtime_popcnt=1;enable_popcnt=yes], [runtime_popcnt=0])
|
2020-06-02 14:48:24 +00:00
|
|
|
|
|
|
|
dnl --disable-clz disallows clz instructions, otherwise they are tested for
|
|
|
|
AC_ARG_ENABLE([clz],
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -328,7 +331,7 @@ have_popcntll=0
|
2020-06-02 14:48:24 +00:00
|
|
|
have_mmpop32=0
|
|
|
|
have_mmpop64=0
|
|
|
|
|
|
|
|
-AS_IF([test $have_hwpopcnt -eq 1],
|
|
|
|
+AS_IF([test $have_hwpopcnt -eq 1 -a $runtime_popcnt -eq 0],
|
|
|
|
[AS_IF([test "$CC" = "icc"],
|
|
|
|
[AC_MSG_CHECKING(if _mm_popcnt_u32() is supported)
|
|
|
|
AC_LINK_IFELSE([AC_LANG_SOURCE([#include <nmmintrin.h>
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -363,6 +366,7 @@ AC_SUBST(have_popcntl)
|
2016-04-21 22:40:59 +00:00
|
|
|
AC_SUBST(have_popcntll)
|
|
|
|
AC_SUBST(have_mmpop32)
|
|
|
|
AC_SUBST(have_mmpop64)
|
|
|
|
+AC_SUBST(runtime_popcnt)
|
|
|
|
|
2020-06-02 14:48:24 +00:00
|
|
|
# Unless --enable-generic is given to configure, we try to use the -march=native compiler
|
|
|
|
# switch. However, it breaks some versions of gcc on MacOSX due to a compiler bug, so
|
2022-11-17 20:47:11 +00:00
|
|
|
--- a/converseg.c
|
|
|
|
+++ b/converseg.c
|
|
|
|
@@ -39,8 +39,7 @@
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
-static boolean
|
|
|
|
-isselfconverse(graph *g, int m, int n)
|
|
|
|
+STATIC_POPCNTFUNC(boolean,isselfconverse,(graph *g, int m, int n),
|
|
|
|
/* Test if self-converse */
|
|
|
|
{
|
|
|
|
int i,j,deg;
|
|
|
|
@@ -93,7 +92,7 @@
|
|
|
|
if (h[ij] != hc[ij]) return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
-}
|
|
|
|
+ })
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
2016-04-21 22:40:59 +00:00
|
|
|
--- a/deledgeg.c
|
|
|
|
+++ b/deledgeg.c
|
|
|
|
@@ -16,6 +16,23 @@
|
|
|
|
|
|
|
|
#include "gtools.h"
|
|
|
|
|
|
|
|
+/*************************************************************************/
|
|
|
|
+STATIC_POPCNTFUNC(int,compute_degree,(const graph *g, int *deg, int m, int n),
|
|
|
|
+{
|
|
|
|
+ const setword *gv;
|
|
|
|
+ int v, actmindeg = n;
|
|
|
|
+
|
|
|
|
+ for (v = 0, gv = g; v < n; ++v, gv += m)
|
|
|
|
+ {
|
|
|
|
+ int i, degv = 0;
|
|
|
|
+ for (i = 0; i < m; ++i)
|
|
|
|
+ degv += POPCOUNT(gv[i]);
|
|
|
|
+ if (degv < actmindeg) actmindeg = degv;
|
|
|
|
+ deg[v] = degv;
|
|
|
|
+ }
|
|
|
|
+ return actmindeg;
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
int
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -25,13 +42,13 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
FILE *infile,*outfile;
|
|
|
|
boolean badargs,dolabel,quiet,dswitch;
|
|
|
|
boolean digraph;
|
|
|
|
- int i,j,m,n,v,w,argnum;
|
|
|
|
+ int j,m,n,v,w,argnum;
|
|
|
|
int codetype,outcode;
|
|
|
|
graph *g,*gq;
|
|
|
|
nauty_counter nin,nout;
|
|
|
|
char *arg,sw;
|
|
|
|
setword *gv,*gw;
|
|
|
|
- int mindeg,actmindeg,degv;
|
|
|
|
+ int mindeg,actmindeg;
|
|
|
|
boolean zswitch;
|
|
|
|
double t;
|
|
|
|
#if MAXN
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -136,16 +153,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
DYNALLOC1(int,deg,deg_sz,n,"deledgeg");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
- actmindeg = n;
|
|
|
|
- for (v = 0, gv = g; v < n; ++v, gv += m)
|
|
|
|
- {
|
|
|
|
- degv = 0;
|
|
|
|
- for (i = 0; i < m; ++i)
|
|
|
|
- degv += POPCOUNT(gv[i]);
|
|
|
|
- if (degv < actmindeg) actmindeg = degv;
|
|
|
|
- deg[v] = degv;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
+ actmindeg = compute_degree(g, deg, m, n);
|
|
|
|
if (actmindeg < mindeg) continue;
|
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
if (zswitch || digraph)
|
2016-04-21 22:40:59 +00:00
|
|
|
--- a/delptg.c
|
|
|
|
+++ b/delptg.c
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -34,6 +34,23 @@
|
|
|
|
static int outcode;
|
|
|
|
static boolean digraph,dolabel;
|
|
|
|
|
|
|
|
+/*************************************************************************/
|
|
|
|
+
|
|
|
|
+STATIC_POPCNTFUNC(boolean,compute_degree,
|
|
|
|
+ (const graph *gx, int nx, int mx, int outmindeg),
|
|
|
|
+{
|
|
|
|
+ set *gxi;
|
|
|
|
+ int i,j,deg;
|
|
|
|
+
|
|
|
|
+ for (i = 0, gxi = (set*)gx; i < nx; ++i, gxi += mx)
|
|
|
|
+ {
|
|
|
|
+ deg = 0;
|
|
|
|
+ for (j = 0; j < mx; ++j) deg += POPCOUNT(gxi[j]);
|
|
|
|
+ if (deg < outmindeg) return FALSE;
|
|
|
|
+ }
|
|
|
|
+ return TRUE;
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
static void
|
|
|
|
@@ -42,7 +59,7 @@
|
|
|
|
/* Delete the stated vertices and write it is mindeg is high enough.
|
|
|
|
* The vertices to delete are del[0] < del[1] < ... < del[ndel-1]. */
|
|
|
|
{
|
|
|
|
- int i,j,k,nx,mx,deg;
|
|
|
|
+ int i,j,k,nx,mx;
|
|
|
|
graph *gi,*gxi,*gq;
|
|
|
|
ssize_t ii;
|
|
|
|
#if MAXN
|
|
|
|
@@ -105,15 +122,8 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
}
|
2022-11-17 20:47:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- if (outmindeg > 0)
|
|
|
|
- {
|
|
|
|
- for (i = 0, gxi = (set*)gx; i < nx; ++i, gxi += mx)
|
|
|
|
- {
|
|
|
|
- deg = 0;
|
|
|
|
- for (j = 0; j < mx; ++j) deg += POPCOUNT(gxi[j]);
|
|
|
|
- if (deg < outmindeg) return;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
+ if (outmindeg > 0 && !compute_degree(gx,nx,mx,outmindeg))
|
|
|
|
+ return;
|
|
|
|
|
|
|
|
if (dolabel)
|
|
|
|
{
|
|
|
|
@@ -261,6 +271,26 @@
|
|
|
|
}
|
2016-04-21 22:40:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+/*************************************************************************/
|
2022-11-17 20:47:11 +00:00
|
|
|
+
|
|
|
|
+STATIC_POPCNTFUNC(int,check_degree,
|
|
|
|
+ (const graph *g, int *okverts, int actmaxv, int iminv, int m, int n,
|
|
|
|
+ long mindeg, long maxdeg),
|
2016-04-21 22:40:59 +00:00
|
|
|
+{
|
|
|
|
+ const setword *gv;
|
2022-11-17 20:47:11 +00:00
|
|
|
+ int i,v,degv,nvok = 0;
|
2016-04-21 22:40:59 +00:00
|
|
|
+
|
2022-11-17 20:47:11 +00:00
|
|
|
+ for (v = 0, gv = g; v < n && v <= actmaxv; ++v, gv += m)
|
2016-04-21 22:40:59 +00:00
|
|
|
+ {
|
2022-11-17 20:47:11 +00:00
|
|
|
+ if (v < iminv) continue;
|
|
|
|
+ degv = 0;
|
|
|
|
+ for (i = 0; i < m; ++i) degv += POPCOUNT(gv[i]);
|
|
|
|
+ if (degv < mindeg || degv > maxdeg) continue;
|
|
|
|
+ okverts[nvok++] = v;
|
2016-04-21 22:40:59 +00:00
|
|
|
+ }
|
2022-11-17 20:47:11 +00:00
|
|
|
+ return nvok;
|
2016-04-21 22:40:59 +00:00
|
|
|
+})
|
|
|
|
+
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
int
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -270,17 +300,15 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
FILE *infile;
|
2022-11-17 20:47:11 +00:00
|
|
|
boolean badargs,quiet,dswitch,nswitch,vswitch,mswitch;
|
|
|
|
boolean adj,nonadj,isolates,delrand;
|
2016-04-21 22:40:59 +00:00
|
|
|
- int i,j,m,n,v,argnum;
|
2022-11-17 20:47:11 +00:00
|
|
|
+ int i,j,m,n,argnum;
|
|
|
|
int ndel,outmindeg;
|
2016-04-21 22:40:59 +00:00
|
|
|
int codetype;
|
|
|
|
graph *g;
|
|
|
|
nauty_counter nin;
|
|
|
|
char *arg,sw;
|
|
|
|
- setword *gv;
|
2022-11-17 20:47:11 +00:00
|
|
|
long mindeg,maxdeg,irand,numrand;
|
|
|
|
long minv,maxv;
|
|
|
|
int iminv,imaxv,actmaxv,nvok;
|
2016-04-21 22:40:59 +00:00
|
|
|
- int degv;
|
|
|
|
double t;
|
|
|
|
#if MAXN
|
2022-11-17 20:47:11 +00:00
|
|
|
int okverts[MAXN];
|
|
|
|
@@ -443,15 +471,7 @@
|
|
|
|
EMPTYSET(avail,m);
|
|
|
|
}
|
2016-04-21 22:40:59 +00:00
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
- nvok = 0;
|
|
|
|
- for (v = 0, gv = g; v < n && v <= actmaxv; ++v, gv += m)
|
2016-04-21 22:40:59 +00:00
|
|
|
- {
|
2022-11-17 20:47:11 +00:00
|
|
|
- if (v < iminv) continue;
|
|
|
|
- degv = 0;
|
|
|
|
- for (i = 0; i < m; ++i) degv += POPCOUNT(gv[i]);
|
|
|
|
- if (degv < mindeg || degv > maxdeg) continue;
|
|
|
|
- okverts[nvok++] = v;
|
2016-04-21 22:40:59 +00:00
|
|
|
- }
|
2022-11-17 20:47:11 +00:00
|
|
|
+ nvok = check_degree(g, okverts, actmaxv, iminv, m, n, mindeg, maxdeg);
|
2016-04-21 22:40:59 +00:00
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
if (nvok < ndel)
|
|
|
|
{
|
2016-04-21 22:40:59 +00:00
|
|
|
--- a/directg.c
|
|
|
|
+++ b/directg.c
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -581,6 +581,16 @@ scan(int level, int ne, int minarcs, int
|
2016-04-21 22:40:59 +00:00
|
|
|
return level-1;
|
|
|
|
}
|
|
|
|
|
|
|
|
+/*************************************************************************/
|
|
|
|
+STATIC_POPCNTFUNC(int __attribute__((pure)),compute_degree,(const set *s, int m),
|
|
|
|
+{
|
|
|
|
+ int i, deg;
|
|
|
|
+
|
|
|
|
+ deg = 0;
|
|
|
|
+ for (i = 0; i < m; ++i) deg += POPCOUNT(s[i]);
|
|
|
|
+ return deg;
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
static void
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -610,8 +620,7 @@ direct(graph *g, int nfixed, long minarc
|
2016-04-21 22:40:59 +00:00
|
|
|
ne = 0;
|
|
|
|
for (i = 0, gi = g; i < n; ++i, gi += m)
|
|
|
|
{
|
|
|
|
- deg = 0;
|
|
|
|
- for (j = 0; j < m; ++j) deg += POPCOUNT(gi[j]);
|
|
|
|
+ deg = compute_degree(gi, m);
|
|
|
|
if (deg == 0)
|
|
|
|
{
|
|
|
|
lab[++j0] = i;
|
|
|
|
--- a/genbg.c
|
|
|
|
+++ b/genbg.c
|
2020-06-02 14:48:24 +00:00
|
|
|
@@ -475,8 +475,7 @@ isconnected(graph *g, int n)
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
-static boolean
|
|
|
|
-distinvar(graph *g, int *invar, int n1, int n2)
|
|
|
|
+STATIC_POPCNTFUNC(boolean,distinvar,(graph *g, int *invar, int n1, int n2),
|
|
|
|
/* make distance invariant/
|
|
|
|
exit immediately FALSE if n-1 not maximal else exit TRUE
|
|
|
|
Note: only invar[n1..n1+n2-1] set */
|
2020-06-02 14:48:24 +00:00
|
|
|
@@ -508,7 +507,7 @@ distinvar(graph *g, int *invar, int n1,
|
2016-04-21 22:40:59 +00:00
|
|
|
if (v < n-1 && inv > invar[n-1]) return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
2020-06-02 14:48:24 +00:00
|
|
|
@@ -664,10 +663,10 @@ userautomproc(int count, int *p, int *or
|
2016-04-21 22:40:59 +00:00
|
|
|
* *
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
-static void
|
|
|
|
-refinex(graph *g, int *lab, int *ptn, int level, int *numcells,
|
|
|
|
+STATIC_POPCNTFUNC(void,refinex,
|
|
|
|
+ (graph *g, int *lab, int *ptn, int level, int *numcells,
|
|
|
|
int *count, set *active, boolean goodret,
|
|
|
|
- int *code, int m, int n)
|
|
|
|
+ int *code, int m, int n),
|
|
|
|
{
|
|
|
|
int i,c1,c2,labc1;
|
|
|
|
setword x;
|
2020-06-02 14:48:24 +00:00
|
|
|
@@ -800,7 +799,7 @@ refinex(graph *g, int *lab, int *ptn, in
|
2016-04-21 22:40:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
2020-06-02 14:48:24 +00:00
|
|
|
@@ -948,9 +947,28 @@ accept1(graph *g, int n2, int x, graph *
|
2016-04-21 22:40:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
+#ifdef INSTRUMENT
|
|
|
|
+#define INSTRUMENT_VAR(var) ++var
|
|
|
|
+#define INSTRUMENT_UNIQ(var) if (nuniq) ++var
|
|
|
|
+#else
|
|
|
|
+#define INSTRUMENT_VAR(var)
|
|
|
|
+#define INSTRUMENT_UNIQ(var)
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
-static boolean
|
|
|
|
-accept2(graph *g, int n2, int x, graph *gx, int *deg, boolean nuniq)
|
|
|
|
+#ifdef PRUNE1
|
|
|
|
+#define DO_PRUNE1(a,b,c,d,e) if (PRUNE1(a,b,c,d,e)) return FALSE
|
|
|
|
+#else
|
|
|
|
+#define DO_PRUNE1(a,b,c,d,e)
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+#ifdef PRUNE2
|
|
|
|
+#define DO_PRUNE2(a,b,c,d,e) if (PRUNE2(a,b,c,d,e)) return FALSE
|
|
|
|
+#else
|
|
|
|
+#define DO_PRUNE2(a,b,c,d,e)
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+STATIC_POPCNTFUNC(boolean,accept2,
|
|
|
|
+ (graph *g, int n2, int x, graph *gx, int *deg, boolean nuniq),
|
|
|
|
/* decide if n in theta(g+x) -- version for n+1 == maxn */
|
|
|
|
{
|
|
|
|
int i,n;
|
2020-06-02 14:48:24 +00:00
|
|
|
@@ -967,10 +985,8 @@ accept2(graph *g, int n2, int x, graph *
|
2016-04-21 22:40:59 +00:00
|
|
|
static DEFAULTOPTIONS_GRAPH(options);
|
|
|
|
setword workspace[50];
|
|
|
|
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a2calls;
|
|
|
|
- if (nuniq) ++a2uniq;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a2calls);
|
|
|
|
+ INSTRUMENT_UNIQ(a2uniq);
|
|
|
|
n = n1 + n2;
|
|
|
|
nx = n + 1;
|
|
|
|
for (i = 0; i < n; ++i)
|
2020-06-02 14:48:24 +00:00
|
|
|
@@ -990,18 +1006,12 @@ accept2(graph *g, int n2, int x, graph *
|
2016-04-21 22:40:59 +00:00
|
|
|
gx[n] |= bit[i];
|
|
|
|
++degx[i];
|
|
|
|
}
|
|
|
|
-#ifdef PRUNE1
|
|
|
|
- if (PRUNE1(gx,degx,n1,n2+1,maxn2)) return FALSE;
|
|
|
|
-#endif
|
|
|
|
+ DO_PRUNE1(gx,degx,n1,n2+1,maxn2);
|
|
|
|
|
|
|
|
if (nuniq)
|
|
|
|
{
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a2succs;
|
|
|
|
-#endif
|
|
|
|
-#ifdef PRUNE2
|
|
|
|
- if (PRUNE2(gx,degx,n1,n2+1,maxn2)) return FALSE;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a2succs);
|
|
|
|
+ DO_PRUNE2(gx,degx,n1,n2+1,maxn2);
|
|
|
|
if (canonise) makecanon(gx,gcan,n1,n2+1);
|
|
|
|
return TRUE;
|
|
|
|
}
|
2020-06-02 14:48:24 +00:00
|
|
|
@@ -1050,12 +1060,8 @@ accept2(graph *g, int n2, int x, graph *
|
2016-04-21 22:40:59 +00:00
|
|
|
{
|
|
|
|
if (j0 == n)
|
|
|
|
{
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a2succs;
|
|
|
|
-#endif
|
|
|
|
-#ifdef PRUNE2
|
|
|
|
- if (PRUNE2(gx,degx,n1,n2+1,maxn2)) return FALSE;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a2succs);
|
|
|
|
+ DO_PRUNE2(gx,degx,n1,n2+1,maxn2);
|
|
|
|
if (canonise) makecanon(gx,gcan,n1,n2+1);
|
|
|
|
return TRUE;
|
|
|
|
}
|
2020-06-02 14:48:24 +00:00
|
|
|
@@ -1106,12 +1112,8 @@ accept2(graph *g, int n2, int x, graph *
|
2016-04-21 22:40:59 +00:00
|
|
|
{
|
|
|
|
if (j0 == n)
|
|
|
|
{
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a2succs;
|
|
|
|
-#endif
|
|
|
|
-#ifdef PRUNE2
|
|
|
|
- if (PRUNE2(gx,degx,n1,n2+1,maxn2)) return FALSE;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a2succs);
|
|
|
|
+ DO_PRUNE2(gx,degx,n1,n2+1,maxn2);
|
|
|
|
if (canonise) makecanon(gx,gcan,n1,n2+1);
|
|
|
|
return TRUE;
|
|
|
|
}
|
2020-06-02 14:48:24 +00:00
|
|
|
@@ -1127,12 +1129,8 @@ accept2(graph *g, int n2, int x, graph *
|
2016-04-21 22:40:59 +00:00
|
|
|
return FALSE;
|
|
|
|
else if (code > 0 || numcells >= nx-4)
|
|
|
|
{
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a2succs;
|
|
|
|
-#endif
|
|
|
|
-#ifdef PRUNE2
|
|
|
|
- if (PRUNE2(gx,degx,n1,n2+1,maxn2)) return FALSE;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a2succs);
|
|
|
|
+ DO_PRUNE2(gx,degx,n1,n2+1,maxn2);
|
|
|
|
if (canonise) makecanon(gx,gcan,n1,n2+1);
|
|
|
|
return TRUE;
|
|
|
|
}
|
2020-06-02 14:48:24 +00:00
|
|
|
@@ -1143,25 +1141,19 @@ accept2(graph *g, int n2, int x, graph *
|
2016-04-21 22:40:59 +00:00
|
|
|
options.defaultptn = FALSE;
|
|
|
|
|
|
|
|
active[0] = 0;
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a2nauty;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a2nauty);
|
|
|
|
nauty(gx,lab,ptn,active,orbits,&options,&stats,workspace,50,1,nx,gcan);
|
|
|
|
|
|
|
|
if (orbits[lab[n]] == orbits[n])
|
|
|
|
{
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a2succs;
|
|
|
|
-#endif
|
|
|
|
-#ifdef PRUNE2
|
|
|
|
- if (PRUNE2(gx,degx,n1,n2+1,maxn2)) return FALSE;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a2succs);
|
|
|
|
+ DO_PRUNE2(gx,degx,n1,n2+1,maxn2);
|
|
|
|
if (canonise) makecanon(gx,gcan,n1,n2+1);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
--- a/geng.c
|
|
|
|
+++ b/geng.c
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -620,8 +620,7 @@
|
|
|
|
return seen == allbits;
|
|
|
|
}
|
|
|
|
|
|
|
|
-static boolean
|
|
|
|
-connpreprune(graph *g, int n, int maxn)
|
|
|
|
+STATIC_POPCNTFUNC(boolean,connpreprune,(graph *g, int n, int maxn),
|
|
|
|
/* This function speeds up the generation of connected graphs
|
|
|
|
with not many edges. */
|
|
|
|
{
|
|
|
|
@@ -653,7 +652,7 @@
|
|
|
|
if (ne - n + nc > maxe - maxn + 1) return TRUE;
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**********************************************************************/
|
|
|
|
|
|
|
|
@@ -720,8 +719,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
/**********************************************************************/
|
|
|
|
|
|
|
|
-static boolean
|
|
|
|
-distinvar(graph *g, int *invar, int n)
|
|
|
|
+STATIC_POPCNTFUNC(boolean,distinvar,(graph *g, int *invar, int n),
|
|
|
|
/* make distance invariant
|
|
|
|
return FALSE if n-1 not maximal else return TRUE */
|
|
|
|
{
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -751,7 +749,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
if (v < n-1 && inv > invar[n-1]) return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -965,8 +963,7 @@
|
2020-06-02 14:48:24 +00:00
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
-static void
|
|
|
|
-makeleveldata(boolean restricted)
|
|
|
|
+STATIC_POPCNTFUNC(void,makeleveldata,(boolean restricted),
|
|
|
|
/* make the level data for each level */
|
|
|
|
{
|
|
|
|
long h;
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1072,7 +1069,7 @@
|
2020-06-02 14:48:24 +00:00
|
|
|
if (xcard[i] > xcard[i-1]) d->xstart[xcard[i]] = i;
|
|
|
|
d->xstart[xcard[nxsets-1]+1] = nxsets;
|
|
|
|
}
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1123,9 +1120,9 @@
|
2020-06-02 14:48:24 +00:00
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
-static void
|
|
|
|
-userautomprocb(int count, int *p, int *orbits,
|
|
|
|
- int numorbits, int stabvertex, int n)
|
|
|
|
+STATIC_POPCNTFUNC(void,
|
|
|
|
+userautomprocb,(int count, int *p, int *orbits,
|
|
|
|
+ int numorbits, int stabvertex, int n),
|
|
|
|
/* form orbits on powerset of VG
|
|
|
|
called by nauty; operates on data[n] */
|
|
|
|
{
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1189,7 +1186,7 @@
|
2020-06-02 14:48:24 +00:00
|
|
|
if (j1 < j2) xorb[j2] = xorb[i] = xorb[pi] = j1;
|
|
|
|
else if (j1 > j2) xorb[j1] = xorb[i] = xorb[pi] = j2;
|
|
|
|
}
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* *
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1202,9 +1199,9 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
* *
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
-static void
|
|
|
|
-refinex(graph *g, int *lab, int *ptn, int level, int *numcells,
|
|
|
|
- int *count, set *active, boolean goodret, int *code, int m, int n)
|
|
|
|
+STATIC_POPCNTFUNC(void,refinex,
|
|
|
|
+ (graph *g, int *lab, int *ptn, int level, int *numcells,
|
|
|
|
+ int *count, set *active, boolean goodret, int *code, int m, int n),
|
|
|
|
{
|
|
|
|
int i,c1,c2,labc1;
|
|
|
|
setword x,lact;
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1335,7 +1332,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1547,9 +1544,35 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
+#ifdef INSTRUMENT
|
2020-06-02 14:48:24 +00:00
|
|
|
+#define INSTRUMENTED_VAR(var) boolean var = FALSE
|
|
|
|
+#define INSTRUMENT_TRUE(var) var = TRUE
|
2016-04-21 22:40:59 +00:00
|
|
|
+#define INSTRUMENT_VAR(var) ++var
|
2020-06-02 14:48:24 +00:00
|
|
|
+#define INSTRUMENT_VAR_IF(var1,var2) if (var1) ++var2
|
2016-04-21 22:40:59 +00:00
|
|
|
+#else
|
2020-06-02 14:48:24 +00:00
|
|
|
+#define INSTRUMENTED_VAR(var)
|
|
|
|
+#define INSTRUMENT_TRUE(var)
|
2016-04-21 22:40:59 +00:00
|
|
|
+#define INSTRUMENT_VAR(var)
|
2020-06-02 14:48:24 +00:00
|
|
|
+#define INSTRUMENT_VAR_IF(var1,var2)
|
2016-04-21 22:40:59 +00:00
|
|
|
+#endif
|
|
|
|
|
|
|
|
-static boolean
|
2020-06-02 14:48:24 +00:00
|
|
|
-accept1(graph *g, int n, xword x, graph *gx, int *deg, boolean *rigid)
|
2016-04-21 22:40:59 +00:00
|
|
|
+#ifdef PREPRUNE
|
|
|
|
+#define DO_PREPRUNE(a,b,c) if (PREPRUNE(a,b,c)) return FALSE
|
|
|
|
+#else
|
|
|
|
+#define DO_PREPRUNE(a,b,c)
|
|
|
|
+#endif
|
|
|
|
+
|
2020-06-02 14:48:24 +00:00
|
|
|
+#ifdef PRUNE
|
|
|
|
+#define DO_PRUNE(a,b,c) if (PRUNE(a,b,c)) return
|
|
|
|
+#define PRUNE_NOT(a,b,c) if (!PRUNE(a,b,c))
|
|
|
|
+#else
|
|
|
|
+#define DO_PRUNE(a,b,c)
|
|
|
|
+#define PRUNE_NOT(a,b,c)
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+STATIC_POPCNTFUNC(boolean,accept1,
|
|
|
|
+ (graph *g, int n, xword x, graph *gx, int *deg, boolean *rigid),
|
|
|
|
/* decide if n in theta(g+x) - version for n+1 < maxn */
|
|
|
|
{
|
|
|
|
int i;
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1564,9 +1587,7 @@
|
|
|
|
static TLS_ATTR DEFAULTOPTIONS_GRAPH(options);
|
2020-06-02 14:48:24 +00:00
|
|
|
setword workspace[50];
|
|
|
|
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a1calls;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a1calls);
|
|
|
|
|
|
|
|
nx = n + 1;
|
|
|
|
for (i = 0; i < n; ++i) gx[i] = g[i];
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1585,9 +1606,7 @@
|
2020-06-02 14:48:24 +00:00
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
if (k4free && hask4(gx,n+1,maxn)) return FALSE;
|
|
|
|
if (clawfree && hasclaw(gx,n+1,maxn)) return FALSE;
|
2020-06-02 14:48:24 +00:00
|
|
|
-#ifdef PREPRUNE
|
|
|
|
- if (PREPRUNE(gx,n+1,maxn)) return FALSE;
|
|
|
|
-#endif
|
|
|
|
+ DO_PREPRUNE(gx,n+1,maxn);
|
2022-11-17 20:47:11 +00:00
|
|
|
if (connec == 2 && n+2 == maxn && !isconnected(gx,n+1)) return FALSE;
|
|
|
|
if (((connec ==2 && n+2 < maxn) || (connec == 1 && n+2 <= maxn))
|
|
|
|
&& connpreprune(gx,n+1,maxn)) return FALSE;
|
|
|
|
@@ -1619,9 +1638,7 @@
|
2020-06-02 14:48:24 +00:00
|
|
|
if (numcells == nx)
|
|
|
|
{
|
|
|
|
*rigid = TRUE;
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a1succs;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a1succs);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1630,28 +1647,24 @@
|
2020-06-02 14:48:24 +00:00
|
|
|
options.userautomproc = userautomproc;
|
|
|
|
|
|
|
|
active[0] = 0;
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a1nauty;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a1nauty);
|
|
|
|
nauty(gx,lab,ptn,active,orbits,&options,&stats,workspace,50,1,nx,h);
|
|
|
|
|
|
|
|
if (orbits[lab[n]] == orbits[n])
|
|
|
|
{
|
|
|
|
*rigid = stats.numorbits == nx;
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a1succs;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a1succs);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
-static boolean
|
|
|
|
-accept1b(graph *g, int n, xword x, graph *gx, int *deg, boolean *rigid,
|
|
|
|
- void (*makeh)(graph*,xword*,int))
|
|
|
|
+STATIC_POPCNTFUNC(boolean,accept1b,
|
|
|
|
+ (graph *g, int n, xword x, graph *gx, int *deg, boolean *rigid,
|
|
|
|
+ void (*makeh)(graph*,xword*,int)),
|
|
|
|
/* decide if n in theta(g+x) -- version for n+1 < maxn */
|
|
|
|
{
|
|
|
|
int i,v;
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1667,9 +1680,7 @@
|
|
|
|
static TLS_ATTR DEFAULTOPTIONS_GRAPH(options);
|
2020-06-02 14:48:24 +00:00
|
|
|
setword workspace[50];
|
|
|
|
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a1calls;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a1calls);
|
|
|
|
|
|
|
|
nx = n + 1;
|
|
|
|
for (i = 0; i < n; ++i) gx[i] = g[i];
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1688,9 +1699,7 @@
|
2020-06-02 14:48:24 +00:00
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
if (k4free && hask4(gx,n+1,maxn)) return FALSE;
|
|
|
|
if (clawfree && hasclaw(gx,n+1,maxn)) return FALSE;
|
2020-06-02 14:48:24 +00:00
|
|
|
-#ifdef PREPRUNE
|
|
|
|
- if (PREPRUNE(gx,n+1,maxn)) return FALSE;
|
|
|
|
-#endif
|
|
|
|
+ DO_PREPRUNE(gx,n+1,maxn);
|
2022-11-17 20:47:11 +00:00
|
|
|
if (connec == 2 && n+2 == maxn && !isconnected(gx,n+1)) return FALSE;
|
|
|
|
if (((connec ==2 && n+2 < maxn) || (connec == 1 && n+2 <= maxe))
|
|
|
|
&& connpreprune(gx,n+1,maxn)) return FALSE;
|
|
|
|
@@ -1742,9 +1751,7 @@
|
2020-06-02 14:48:24 +00:00
|
|
|
if (numcells == nx)
|
|
|
|
{
|
|
|
|
*rigid = TRUE;
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a1succs;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a1succs);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1753,27 +1760,23 @@
|
2020-06-02 14:48:24 +00:00
|
|
|
options.userautomproc = userautomprocb;
|
|
|
|
|
|
|
|
active[0] = 0;
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a1nauty;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a1nauty);
|
|
|
|
nauty(gx,lab,ptn,active,orbits,&options,&stats,workspace,50,1,nx,gc);
|
|
|
|
|
|
|
|
if (orbits[lab[n]] == orbits[n])
|
|
|
|
{
|
|
|
|
*rigid = stats.numorbits == nx;
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a1succs;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a1succs);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
-static boolean
|
|
|
|
-accept2(graph *g, int n, xword x, graph *gx, int *deg, boolean nuniq)
|
2016-04-21 22:40:59 +00:00
|
|
|
+STATIC_POPCNTFUNC(boolean,accept2,
|
|
|
|
+ (graph *g, int n, xword x, graph *gx, int *deg, boolean nuniq),
|
|
|
|
/* decide if n in theta(g+x) -- version for n+1 == maxn */
|
|
|
|
{
|
|
|
|
int i;
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1791,10 +1794,8 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
setword workspace[50];
|
|
|
|
boolean cheapacc;
|
|
|
|
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a2calls;
|
|
|
|
- if (nuniq) ++a2uniq;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a2calls);
|
2020-06-02 14:48:24 +00:00
|
|
|
+ INSTRUMENT_VAR_IF(nuniq,a2uniq);
|
2016-04-21 22:40:59 +00:00
|
|
|
nx = n + 1;
|
|
|
|
for (i = 0; i < n; ++i)
|
|
|
|
{
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1816,18 +1817,14 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
if (k4free && hask4(gx,n+1,maxn)) return FALSE;
|
|
|
|
if (clawfree && hasclaw(gx,n+1,maxn)) return FALSE;
|
2016-04-21 22:40:59 +00:00
|
|
|
-#ifdef PREPRUNE
|
|
|
|
- if (PREPRUNE(gx,n+1,maxn)) return FALSE;
|
|
|
|
-#endif
|
|
|
|
+ DO_PREPRUNE(gx,n+1,maxn);
|
2022-11-17 20:47:11 +00:00
|
|
|
if (connec == 2 && n+2 == maxn && !isconnected(gx,n+1)) return FALSE;
|
|
|
|
if (((connec ==2 && n+2 < maxn) || (connec == 1 && n+2 <= maxe))
|
|
|
|
&& connpreprune(gx,n+1,maxn)) return FALSE;
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
if (nuniq)
|
|
|
|
{
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a2succs;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a2succs);
|
|
|
|
if (canonise) makecanon(gx,gcan,nx);
|
|
|
|
return TRUE;
|
|
|
|
}
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1867,9 +1864,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
{
|
|
|
|
if (j0 == n)
|
|
|
|
{
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a2succs;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a2succs);
|
|
|
|
if (canonise) makecanon(gx,gcan,nx);
|
|
|
|
return TRUE;
|
|
|
|
}
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1912,9 +1907,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
{
|
|
|
|
if (j0 == n)
|
|
|
|
{
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a2succs;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a2succs);
|
|
|
|
if (canonise) makecanon(gx,gcan,nx);
|
|
|
|
return TRUE;
|
|
|
|
}
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1954,9 +1947,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
if (cheapacc)
|
|
|
|
{
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a2succs;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a2succs);
|
|
|
|
if (canonise) makecanon(gx,gcan,nx);
|
|
|
|
return TRUE;
|
|
|
|
}
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1965,22 +1956,18 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
options.defaultptn = FALSE;
|
|
|
|
|
|
|
|
active[0] = 0;
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a2nauty;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a2nauty);
|
|
|
|
nauty(gx,lab,ptn,active,orbits,&options,&stats,workspace,50,1,nx,gcan);
|
|
|
|
|
|
|
|
if (orbits[lab[n]] == orbits[n])
|
|
|
|
{
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a2succs;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a2succs);
|
|
|
|
if (canonise) makecanon(gx,gcan,nx);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -2025,9 +2012,9 @@
|
2020-06-02 14:48:24 +00:00
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
-static void
|
|
|
|
-spaextend(graph *g, int n, int *deg, int ne, boolean rigid,
|
|
|
|
- int xlb, int xub, void (*makeh)(graph*,xword*,int))
|
|
|
|
+STATIC_POPCNTFUNC(void,spaextend,
|
|
|
|
+ (graph *g, int n, int *deg, int ne, boolean rigid,
|
|
|
|
+ int xlb, int xub, void (*makeh)(graph*,xword*,int)),
|
|
|
|
/* extend from n to n+1 -- version for restricted graphs */
|
|
|
|
{
|
|
|
|
xword x,d,dlow;
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -2038,12 +2025,8 @@
|
2020-06-02 14:48:24 +00:00
|
|
|
int degx[MAXN];
|
|
|
|
boolean rigidx;
|
|
|
|
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- boolean haschild;
|
|
|
|
-
|
|
|
|
- haschild = FALSE;
|
|
|
|
- if (rigid) ++rigidnodes[n];
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENTED_VAR(haschild);
|
|
|
|
+ INSTRUMENT_VAR_IF(rigid,rigidnodes[n]);
|
|
|
|
++nodes[n];
|
|
|
|
|
|
|
|
nx = n + 1;
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -2063,9 +2046,7 @@
|
|
|
|
if (splitgraph && notsplit(g,n,maxn)) return;
|
|
|
|
if (chordal && notchordal(g,n,maxn)) return;
|
|
|
|
if (perfect && notperfect(g,n,maxn)) return;
|
2020-06-02 14:48:24 +00:00
|
|
|
-#ifdef PRUNE
|
|
|
|
- if (PRUNE(g,n,maxn)) return;
|
|
|
|
-#endif
|
|
|
|
+ DO_PRUNE(g,n,maxn);
|
|
|
|
|
|
|
|
xorb = data[n].xorb;
|
|
|
|
xx = data[n].xx;
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -2091,13 +2072,9 @@
|
|
|
|
if (splitgraph && notsplit(gx,nx,maxn)) continue;
|
|
|
|
if (chordal && notchordal(gx,nx,maxn)) continue;
|
|
|
|
if (perfect && notperfect(gx,nx,maxn)) continue;
|
2020-06-02 14:48:24 +00:00
|
|
|
-#ifdef PRUNE
|
|
|
|
- if (!PRUNE(gx,nx,maxn))
|
|
|
|
-#endif
|
|
|
|
+ PRUNE_NOT(gx,nx,maxn)
|
|
|
|
{
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- haschild = TRUE;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_TRUE(haschild);
|
|
|
|
++ecount[ne+xc];
|
|
|
|
(*outproc)(outfile,canonise ? gcan : gx,nx);
|
|
|
|
}
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -2130,9 +2107,7 @@
|
2020-06-02 14:48:24 +00:00
|
|
|
if (xlbx <= xubx
|
|
|
|
&& accept1b(g,n,x,gx,degx,&rigidx,makeh))
|
|
|
|
{
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- haschild = TRUE;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_TRUE(haschild);
|
|
|
|
spaextend(gx,nx,degx,ne+xc,rigidx,xlbx,xubx,makeh);
|
|
|
|
}
|
|
|
|
}
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -2141,15 +2116,13 @@
|
2020-06-02 14:48:24 +00:00
|
|
|
&& nodes[n] >= multiplicity)
|
|
|
|
--splitlevel;
|
|
|
|
}
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- if (haschild) ++fertilenodes[n];
|
|
|
|
-#endif
|
|
|
|
-}
|
|
|
|
+ INSTRUMENT_VAR_IF(haschild, fertilenodes[n]);
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
-static void
|
|
|
|
-genextend(graph *g, int n, int *deg, int ne, boolean rigid, int xlb, int xub)
|
|
|
|
+STATIC_POPCNTFUNC(void,genextend,
|
|
|
|
+ (graph *g, int n, int *deg, int ne, boolean rigid, int xlb, int xub),
|
|
|
|
/* extend from n to n+1 -- version for general graphs */
|
|
|
|
{
|
|
|
|
xword x,d,dlow;
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -2161,12 +2134,8 @@
|
2020-06-02 14:48:24 +00:00
|
|
|
int degx[MAXN];
|
|
|
|
boolean rigidx;
|
|
|
|
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- boolean haschild;
|
|
|
|
-
|
|
|
|
- haschild = FALSE;
|
|
|
|
- if (rigid) ++rigidnodes[n];
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENTED_VAR(haschild);
|
|
|
|
+ INSTRUMENT_VAR_IF(rigid,rigidnodes[n]);
|
|
|
|
++nodes[n];
|
|
|
|
|
|
|
|
nx = n + 1;
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -2186,9 +2155,7 @@
|
|
|
|
if (splitgraph && notsplit(g,n,maxn)) return;
|
|
|
|
if (chordal && notchordal(g,n,maxn)) return;
|
|
|
|
if (perfect && notperfect(g,n,maxn)) return;
|
2020-06-02 14:48:24 +00:00
|
|
|
-#ifdef PRUNE
|
|
|
|
- if (PRUNE(g,n,maxn)) return;
|
|
|
|
-#endif
|
|
|
|
+ DO_PRUNE(g,n,maxn);
|
|
|
|
|
|
|
|
imin = data[n].xstart[xlb];
|
|
|
|
imax = data[n].xstart[xub+1];
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -2213,13 +2180,9 @@
|
|
|
|
if (splitgraph && notsplit(gx,nx,maxn)) continue;
|
|
|
|
if (chordal && notchordal(gx,nx,maxn)) continue;
|
|
|
|
if (perfect && notperfect(gx,nx,maxn)) continue;
|
2020-06-02 14:48:24 +00:00
|
|
|
-#ifdef PRUNE
|
|
|
|
- if (!PRUNE(gx,nx,maxn))
|
|
|
|
-#endif
|
|
|
|
+ PRUNE_NOT(gx,nx,maxn)
|
|
|
|
{
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- haschild = TRUE;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_TRUE(haschild);
|
|
|
|
++ecount[ne+xc];
|
|
|
|
(*outproc)(outfile,canonise ? gcan : gx,nx);
|
|
|
|
}
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -2250,9 +2213,7 @@
|
2020-06-02 14:48:24 +00:00
|
|
|
data[nx].hi = data[nx].xstart[xubx+1];
|
|
|
|
if (accept1(g,n,x,gx,degx,&rigidx))
|
|
|
|
{
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- haschild = TRUE;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_TRUE(haschild);
|
|
|
|
genextend(gx,nx,degx,ne+xc,rigidx,xlbx,xubx);
|
|
|
|
}
|
|
|
|
}
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -2260,10 +2221,8 @@
|
2020-06-02 14:48:24 +00:00
|
|
|
if (n == splitlevel-1 && n >= min_splitlevel
|
|
|
|
&& nodes[n] >= multiplicity)
|
|
|
|
--splitlevel;
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- if (haschild) ++fertilenodes[n];
|
|
|
|
-#endif
|
|
|
|
-}
|
|
|
|
+ INSTRUMENT_VAR_IF(haschild, fertilenodes[n]);
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
/**************************************************************************/
|
2022-11-17 20:47:11 +00:00
|
|
|
--- a/genposetg.c
|
|
|
|
+++ b/genposetg.c
|
|
|
|
@@ -289,9 +289,8 @@
|
|
|
|
|
|
|
|
/**********************************************************************************/
|
|
|
|
|
|
|
|
-
|
|
|
|
-static boolean refinex(graph *g, int *lab, int *ptn, int *numcells,
|
|
|
|
- int *count, set *active, setword good_vertices, int n)
|
|
|
|
+STATIC_POPCNTFUNC(boolean,refinex,(graph *g, int *lab, int *ptn, int *numcells,
|
|
|
|
+ int *count, set *active, setword good_vertices, int n),
|
|
|
|
/* custom version of refine1() which can exit quickly if required.
|
|
|
|
|
|
|
|
If good_vertices is not 0, a FALSE return is made if it can be determined
|
|
|
|
@@ -427,7 +426,7 @@
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
-}
|
|
|
|
+ })
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
@@ -781,7 +780,8 @@
|
|
|
|
|
|
|
|
/**********************************AUFSCHREIBEN_2***********************************/
|
|
|
|
|
|
|
|
-static void aufschreiben_2(int last_level, graph maxpoints,int relationscounter)
|
|
|
|
+STATIC_POPCNTFUNC(void,aufschreiben_2,
|
|
|
|
+ (int last_level, graph maxpoints,int relationscounter),
|
|
|
|
|
|
|
|
/* Hier werden die Graphen konstruiert, die mit einer Kette von
|
|
|
|
jeweils nur einem Knoten pro Level anfangen. Sie entstehen aus
|
|
|
|
@@ -790,9 +790,6 @@
|
|
|
|
entsprechender Laenge angehaengt wird. */
|
|
|
|
|
|
|
|
{
|
|
|
|
-#if 0
|
|
|
|
- graph puffer;
|
|
|
|
-#endif
|
|
|
|
graph poset2[MAXN];
|
|
|
|
char *i2;
|
|
|
|
int i;
|
|
|
|
@@ -812,20 +809,13 @@
|
|
|
|
|
|
|
|
if (output)
|
|
|
|
{
|
|
|
|
-#if 0
|
|
|
|
- puffer=maxpunktzahl;
|
|
|
|
- fwrite(&puffer,sizeof(graph),1,stdout);
|
|
|
|
-#endif
|
|
|
|
memcpy(poset2,poset,sizeof(graph)*punktzahl);
|
|
|
|
poset2[maxpunktzahl-1]=0;
|
|
|
|
for (i=punktzahl; i<(maxpunktzahl-1); i++) poset2[i]=bit[i+1];
|
|
|
|
FOREACH(i2,all_points_up_to[0]) ADDELEMENT(poset2+(*i2),punktzahl);
|
|
|
|
-#if 0
|
|
|
|
- fwrite(poset2,sizeof(graph),maxpunktzahl,stdout);
|
|
|
|
-#endif
|
|
|
|
writeposet(poset2,maxpunktzahl);
|
|
|
|
}
|
|
|
|
-}
|
|
|
|
+ })
|
|
|
|
|
|
|
|
/**********************************AUFSCHREIBEN_3***********************************/
|
|
|
|
|
|
|
|
@@ -953,10 +943,20 @@
|
|
|
|
|
|
|
|
/**********************************ADD_LAST_POINT******************************************/
|
|
|
|
|
|
|
|
+#ifdef COUNT
|
|
|
|
+#define OUTPUT_POSET
|
|
|
|
+#define OUTPUT_NULL
|
|
|
|
+#else
|
|
|
|
+#define OUTPUT_POSET if (output) { poset[punktzahl]=*run; punktzahl++; aufschreiben(); punktzahl--; }
|
|
|
|
+#define OUTPUT_NULL if (output) { aufschreiben(); }
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+
|
|
|
|
/* Fuegt den letzten Punkt hinzu -- wie add_point, nur dass Sachen, die der Weiterfuehrung
|
|
|
|
dienen nicht mehr gemacht werden. Darf nur fuer den letzten Punkt aufgerufen werden ! */
|
|
|
|
|
|
|
|
-static void add_last_point (int level, int do_nauty, graph *last_nbs, graph maxpoints, int relationscounter)
|
|
|
|
+STATIC_POPCNTFUNC(void,add_last_point,
|
|
|
|
+ (int level, int do_nauty, graph *last_nbs, graph maxpoints, int relationscounter),
|
|
|
|
|
|
|
|
/* do_nauty ist genau dann 0, wenn nauty gerade ausgefuehrt wurde, um die
|
|
|
|
Kanonizitaet des letzten Knotens zu testen, orbits, generators, etc
|
|
|
|
@@ -1138,10 +1138,7 @@
|
|
|
|
{ dummy=all_ancestors[*run];
|
|
|
|
relations[relationscounter+POPCOUNT(dummy)]++;
|
|
|
|
minmaxline[POPCOUNT(maxpoints & ~dummy)]++;
|
|
|
|
-#ifndef COUNT
|
|
|
|
- if (output)
|
|
|
|
- { poset[punktzahl]=*run; punktzahl++; aufschreiben(); punktzahl--; }
|
|
|
|
-#endif
|
|
|
|
+ OUTPUT_POSET;
|
|
|
|
}
|
|
|
|
} /* ende noch kein Punkt auf dem Level */
|
|
|
|
|
|
|
|
@@ -1183,10 +1180,7 @@
|
|
|
|
{ dummy=all_ancestors[*run];
|
|
|
|
relations[relationscounter+POPCOUNT(dummy)]++;
|
|
|
|
minmaxline[POPCOUNT(maxpoints & ~dummy)]++;
|
|
|
|
-#ifndef COUNT
|
|
|
|
- if (output)
|
|
|
|
- { aufschreiben(); }
|
|
|
|
-#endif
|
|
|
|
+ OUTPUT_NULL;
|
|
|
|
}
|
|
|
|
else /* zunaechst noch zwei Heuristiken: Wenn alle mit der gleichen orbitnummer identische
|
|
|
|
Nachbarschaften haben (d.h. nicht verschiedene, die nur im gleichen Orbit liegen),
|
|
|
|
@@ -1201,10 +1195,7 @@
|
|
|
|
dummy=all_ancestors[*run];
|
|
|
|
relations[relationscounter+POPCOUNT(dummy)]++;
|
|
|
|
minmaxline[POPCOUNT(maxpoints & ~dummy)]++;
|
|
|
|
-#ifndef COUNT
|
|
|
|
- if (output)
|
|
|
|
- { aufschreiben(); }
|
|
|
|
-#endif
|
|
|
|
+ OUTPUT_NULL;
|
|
|
|
}
|
|
|
|
else /* noch ein Sonderfall: Wenn die maximale Orbitgroesse 2 ist und noch kein Knoten
|
|
|
|
mit Nachbarn eines anderen Orbits auf dem Level, so ist der Knoten kanonisch,
|
|
|
|
@@ -1304,10 +1295,7 @@
|
|
|
|
dummy=all_ancestors[*run];
|
|
|
|
relations[relationscounter+POPCOUNT(dummy)]++;
|
|
|
|
minmaxline[POPCOUNT(maxpoints & ~dummy)]++;
|
|
|
|
-#ifndef COUNT
|
|
|
|
- if (output)
|
|
|
|
- { aufschreiben(); }
|
|
|
|
-#endif
|
|
|
|
+ OUTPUT_NULL;
|
|
|
|
} /* ende akzeptiert mit nauty */
|
|
|
|
|
|
|
|
} /* ende halt doch nauty */
|
|
|
|
@@ -1319,10 +1307,7 @@
|
|
|
|
dummy=all_ancestors[*run];
|
|
|
|
relations[relationscounter+POPCOUNT(dummy)]++;
|
|
|
|
minmaxline[POPCOUNT(maxpoints & ~dummy)]++;
|
|
|
|
-#ifndef COUNT
|
|
|
|
- if (output)
|
|
|
|
- { aufschreiben(); }
|
|
|
|
-#endif
|
|
|
|
+ OUTPUT_NULL;
|
|
|
|
}
|
|
|
|
} /* else nauty... */
|
|
|
|
} /* else mit Heuristik... */
|
|
|
|
@@ -1333,7 +1318,7 @@
|
|
|
|
local_ptn[punktzahl-1]=0;
|
|
|
|
} /* ende mindestens ein Punkt bereits auf dem Level */
|
|
|
|
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1345,7 +1330,8 @@
|
|
|
|
|
|
|
|
/* Fuegt einen weiteren Punkt hinzu */
|
|
|
|
|
|
|
|
-static void add_point (int level, int do_nauty, graph *last_nbs, graph maxpoints, int relationscounter)
|
|
|
|
+STATIC_POPCNTFUNC(void,add_point,
|
|
|
|
+ (int level, int do_nauty, graph *last_nbs, graph maxpoints, int relationscounter),
|
|
|
|
|
|
|
|
/* do_nauty ist genau dann 0, wenn nauty gerade ausgefuehrt wurde, um die
|
|
|
|
Kanonizitaet des letzten Knotens zu testen, orbits, generators, etc
|
|
|
|
@@ -1767,7 +1753,7 @@
|
|
|
|
local_ptn[punktzahl-1]=0;
|
|
|
|
} /* ende mindestens ein Punkt bereits auf dem Level */
|
|
|
|
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/***************************************MAIN*******************************************/
|
|
|
|
|
2016-04-21 22:40:59 +00:00
|
|
|
--- a/genquarticg.c
|
|
|
|
+++ b/genquarticg.c
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -222,9 +222,9 @@ isbiconnected(graph *g, int n)
|
2016-04-21 22:40:59 +00:00
|
|
|
* of the graph reaches nmax after which it is written to outputfile *
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
-static void
|
|
|
|
-extend(int n, graph *g, edgestruct *edge, pairstruct *epair, int numpair,
|
|
|
|
- int *epairorbit, int *multar, setword *zar, int *col00w, boolean connectflag)
|
|
|
|
+STATIC_POPCNTFUNC(void,extend,
|
|
|
|
+ (int n, graph *g, edgestruct *edge, pairstruct *epair, int numpair,
|
|
|
|
+ int *epairorbit, int *multar, setword *zar, int *col00w, boolean connectflag),
|
|
|
|
{
|
2020-06-02 14:48:24 +00:00
|
|
|
int vm1, vm2, vm3, vm4, vt1, vt2, vt3, vt4, c, b, mcol1,
|
|
|
|
tcol, got_one, i, j, numpair1, numdovi, maxdovi, i1, j1, i2, j2,
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -902,7 +902,7 @@ extend(int n, graph *g, edgestruct *edge
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
} //end for c..
|
|
|
|
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* *
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1146,9 +1146,9 @@ init_refinex( int *clr, int *lb, int *p,
|
2016-04-21 22:40:59 +00:00
|
|
|
* code := -1 for n-1 not max, 0 for maybe, 1 for definite *
|
|
|
|
* *
|
|
|
|
*****************************************************************************/
|
|
|
|
-static void
|
|
|
|
-refinex(graph *g, int *lab, int *ptn, int level, int *numcells, int *count,
|
|
|
|
- set *active, boolean goodret, int *code, int m, int n)
|
|
|
|
+STATIC_POPCNTFUNC(void,refinex,
|
|
|
|
+ (graph *g, int *lab, int *ptn, int level, int *numcells, int *count,
|
|
|
|
+ set *active, boolean goodret, int *code, int m, int n),
|
|
|
|
{
|
|
|
|
int i, c1, c2, labc1, split1, split2, cell1, cell2, cnt, bmin, bmax;
|
|
|
|
int workperm[MAXN], bucket[MAXN+2];
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1276,7 +1276,7 @@ refinex(graph *g, int *lab, int *ptn, in
|
2016-04-21 22:40:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
--- a/gentourng.c
|
|
|
|
+++ b/gentourng.c
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -549,9 +549,9 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
* *
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
-static void
|
|
|
|
-refinex(graph *g, int *lab, int *ptn, int level, int *numcells,
|
|
|
|
- int *count, set *active, boolean goodret, int *code, int m, int n)
|
|
|
|
+STATIC_POPCNTFUNC(void,refinex,
|
|
|
|
+ (graph *g, int *lab, int *ptn, int level, int *numcells,
|
|
|
|
+ int *count, set *active, boolean goodret, int *code, int m, int n),
|
|
|
|
{
|
|
|
|
int i,c1,c2,labc1;
|
|
|
|
setword x,lact;
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -683,7 +683,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -805,8 +805,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
-static boolean
|
|
|
|
-hitinvar(graph *g, int *invar, int n)
|
|
|
|
+STATIC_POPCNTFUNC(boolean,hitinvar,(graph *g, int *invar, int n),
|
|
|
|
/* make hitting invariant
|
|
|
|
* return FALSE if n-1 not maximal else return TRUE */
|
|
|
|
{
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -829,12 +828,26 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
if (v < n-1 && inv > invar[n-1]) return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
-static boolean
|
|
|
|
-accept2(graph *g, int n, xword x, graph *gx, int *deg, boolean nuniq)
|
|
|
|
+#ifdef INSTRUMENT
|
|
|
|
+#define INSTRUMENT_VAR(var) ++var
|
|
|
|
+#define INSTRUMENT_UNIQ(var) if (nuniq) ++var
|
|
|
|
+#else
|
|
|
|
+#define INSTRUMENT_VAR(var)
|
|
|
|
+#define INSTRUMENT_UNIQ(var)
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+#ifdef PREPRUNE
|
|
|
|
+#define DO_PREPRUNE(a,b,c) if (PREPRUNE(a,b,c)) return FALSE
|
|
|
|
+#else
|
|
|
|
+#define DO_PREPRUNE(a,b,c)
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+STATIC_POPCNTFUNC(boolean,accept2,
|
|
|
|
+ (graph *g, int n, xword x, graph *gx, int *deg, boolean nuniq),
|
|
|
|
/* decide if n in theta(g+x) -- version for n+1 == maxn */
|
|
|
|
{
|
|
|
|
int i;
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -851,10 +864,8 @@
|
2021-09-02 20:09:07 +00:00
|
|
|
setword workspace[200];
|
2022-11-17 20:47:11 +00:00
|
|
|
boolean cheapacc;
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a2calls;
|
|
|
|
- if (nuniq) ++a2uniq;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a2calls);
|
|
|
|
+ INSTRUMENT_UNIQ(a2uniq);
|
|
|
|
nx = n + 1;
|
|
|
|
gxn = 0;
|
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -875,15 +886,11 @@
|
|
|
|
gx[n] = gxn;
|
2016-04-21 22:40:59 +00:00
|
|
|
degx[n] = degn = XPOPCOUNT(x);
|
2022-11-17 20:47:11 +00:00
|
|
|
|
2016-04-21 22:40:59 +00:00
|
|
|
-#ifdef PREPRUNE
|
|
|
|
- if (PREPRUNE(gx,n+1,maxn)) return FALSE;
|
|
|
|
-#endif
|
|
|
|
+ DO_PREPRUNE(gx,n+1,maxn);
|
|
|
|
|
|
|
|
if (nuniq)
|
|
|
|
{
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a2succs;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a2succs);
|
|
|
|
if (canonise) makecanon(gx,gcan,nx);
|
|
|
|
return TRUE;
|
|
|
|
}
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -922,9 +929,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
{
|
|
|
|
if (j0 == n)
|
|
|
|
{
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a2succs;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a2succs);
|
|
|
|
if (canonise) makecanon(gx,gcan,nx);
|
|
|
|
return TRUE;
|
|
|
|
}
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -967,9 +972,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
{
|
|
|
|
if (j0 == n)
|
|
|
|
{
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a2succs;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a2succs);
|
|
|
|
if (canonise) makecanon(gx,gcan,nx);
|
|
|
|
return TRUE;
|
|
|
|
}
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -988,9 +991,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
if (cheapacc)
|
|
|
|
{
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a2succs;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a2succs);
|
|
|
|
if (canonise) makecanon(gx,gcan,nx);
|
|
|
|
return TRUE;
|
|
|
|
}
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1000,22 +1001,18 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
options.defaultptn = FALSE;
|
|
|
|
|
|
|
|
active[0] = 0;
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a2nauty;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a2nauty);
|
2021-09-02 20:09:07 +00:00
|
|
|
nauty(gx,lab,ptn,active,orbits,&options,&stats,workspace,200,1,nx,gcan);
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
if (orbits[lab[n]] == orbits[n])
|
|
|
|
{
|
|
|
|
-#ifdef INSTRUMENT
|
|
|
|
- ++a2succs;
|
|
|
|
-#endif
|
|
|
|
+ INSTRUMENT_VAR(a2succs);
|
|
|
|
if (canonise) makecanon(gx,gcan,nx);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
--- a/gutil1.c
|
|
|
|
+++ b/gutil1.c
|
|
|
|
@@ -5,9 +5,9 @@
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
-void
|
|
|
|
-degstats(graph *g, int m, int n, unsigned long *edges, int *mindeg,
|
|
|
|
- int *mincount, int *maxdeg, int *maxcount, boolean *eulerian)
|
|
|
|
+POPCNTFUNC(void,degstats,
|
|
|
|
+ (graph *g, int m, int n, unsigned long *edges, int *mindeg,
|
|
|
|
+ int *mincount, int *maxdeg, int *maxcount, boolean *eulerian),
|
|
|
|
/* Compute degree-related graph properties.
|
|
|
|
*edges = number of edges
|
|
|
|
*mindeg, *mincount = minimum degree and how many there are
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -60,13 +60,13 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
*maxcount = maxdc;
|
|
|
|
*edges = ned / 2;
|
|
|
|
*eulerian = (dor & 1) == 0;
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
2020-06-02 14:48:24 +00:00
|
|
|
-void
|
|
|
|
-degstats3(graph *g, int m, int n, unsigned long *edges, int *mindeg,
|
|
|
|
- int *mincount, int *maxdeg, int *maxcount, int *odddeg)
|
|
|
|
+POPCNTFUNC(void,degstats3,
|
|
|
|
+ (graph *g, int m, int n, unsigned long *edges, int *mindeg,
|
|
|
|
+ int *mincount, int *maxdeg, int *maxcount, int *odddeg),
|
|
|
|
/* Compute degree-related graph properties.
|
|
|
|
*edges = number of edges
|
|
|
|
*mindeg, *mincount = minimum degree and how many there are
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -119,16 +119,16 @@
|
2020-06-02 14:48:24 +00:00
|
|
|
*maxcount = maxdc;
|
|
|
|
*edges = ned / 2;
|
|
|
|
*odddeg = dodd;
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
2016-04-21 22:40:59 +00:00
|
|
|
-void
|
|
|
|
-degstats2(graph *g, boolean digraph, int m, int n,
|
|
|
|
+POPCNTFUNC(void,degstats2,
|
|
|
|
+ (graph *g, boolean digraph, int m, int n,
|
|
|
|
unsigned long *edges, int *loops,
|
|
|
|
int *minindeg, int *minincount, int *maxindeg, int *maxincount,
|
|
|
|
int *minoutdeg, int *minoutcount, int *maxoutdeg, int *maxoutcount,
|
|
|
|
- boolean *eulerian)
|
|
|
|
+ boolean *eulerian),
|
|
|
|
/* Compute degree-related graph properties.
|
|
|
|
*edges = number of edges (including loops), directed edges for digraphs
|
|
|
|
*loops = number of loops
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -300,12 +300,12 @@
|
|
|
|
if (indeg[i] != outdeg[i]) break;
|
|
|
|
*eulerian = (i == n);
|
2016-04-21 22:40:59 +00:00
|
|
|
}
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/*********************************************************************/
|
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
-void
|
|
|
|
-sources_sinks(graph *g, int m, int n, int *sources, int *sinks)
|
|
|
|
+POPCNTFUNC(void,sources_sinks,
|
|
|
|
+ (graph *g, int m, int n, int *sources, int *sinks),
|
|
|
|
/* Count the sources and sinks. For an undirected graph, these
|
|
|
|
are just the isolated vertices. For a directed graph, they have
|
|
|
|
their usual meanings. A vertex with a loop is neither a source
|
|
|
|
@@ -315,12 +315,8 @@
|
|
|
|
setword rowor,wk;
|
|
|
|
int i,j,nsource,nsink;
|
|
|
|
set *gi;
|
|
|
|
-#if MAXM
|
|
|
|
- setword work[MAXM+1];
|
|
|
|
-#else
|
|
|
|
- DYNALLSTAT(setword,work,work_sz);
|
|
|
|
- DYNALLOC1(setword,work,work_sz,m,"sources_sinks");
|
|
|
|
-#endif
|
|
|
|
+ DCL_DYNSETWORD(work);
|
|
|
|
+ DEF_DYNSETWORD(work,m,"sources_sinks");
|
|
|
|
|
|
|
|
if (n == 0) { *sources = *sinks = 0; return; }
|
|
|
|
|
|
|
|
@@ -355,12 +351,11 @@
|
|
|
|
for (j = 0; j < m; ++j)
|
|
|
|
nsource -= POPCOUNT(work[j]);
|
|
|
|
*sources = nsource;
|
|
|
|
-}
|
|
|
|
+ })
|
|
|
|
|
|
|
|
/*********************************************************************/
|
|
|
|
|
2016-04-21 22:40:59 +00:00
|
|
|
-boolean
|
|
|
|
-isconnected1(graph *g, int n)
|
|
|
|
+POPCNTFUNC(boolean,isconnected1,(graph *g, int n),
|
|
|
|
/* test if g is connected (m=1) */
|
|
|
|
{
|
|
|
|
setword seen,expanded,toexpand;
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -379,7 +374,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return POPCOUNT(seen) == n;
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -430,25 +425,19 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
-boolean
|
|
|
|
-issubconnected(graph *g, set *sub, int m, int n)
|
|
|
|
+POPCNTFUNC(boolean,issubconnected,(graph *g, set *sub, int m, int n),
|
|
|
|
/* Test if the subset of g induced by sub is connected. Empty is connected. */
|
2020-06-02 14:48:24 +00:00
|
|
|
/* Note that the value for empty subgraphs disagrees with isconnected() */
|
2016-04-21 22:40:59 +00:00
|
|
|
{
|
|
|
|
int i,head,tail,w,subsize;
|
|
|
|
set *gw;
|
|
|
|
-#if MAXN
|
|
|
|
- int queue[MAXN],visited[MAXN];
|
|
|
|
- setword subw[MAXM];
|
|
|
|
-#else
|
|
|
|
- DYNALLSTAT(int,queue,queue_sz);
|
|
|
|
- DYNALLSTAT(int,visited,visited_sz);
|
|
|
|
- DYNALLSTAT(set,subw,subw_sz);
|
|
|
|
+ DCL_DYNINT(queue);
|
|
|
|
+ DCL_DYNINT(visited);
|
|
|
|
+ DCL_DYNSET(subw);
|
|
|
|
|
|
|
|
- DYNALLOC1(int,queue,queue_sz,n,"issubconnected");
|
|
|
|
- DYNALLOC1(int,visited,visited_sz,n,"issubconnected");
|
|
|
|
- DYNALLOC1(set,subw,subw_sz,m,"issubconnected");
|
|
|
|
-#endif
|
|
|
|
+ DEF_DYNINT(queue,n,"issubconnected");
|
|
|
|
+ DEF_DYNINT(visited,n,"issubconnected");
|
|
|
|
+ DEF_DYNSET(subw,m,"issubconnected");
|
|
|
|
|
|
|
|
subsize = 0;
|
|
|
|
for (i = 0; i < m; ++i) subsize += (sub[i] ? POPCOUNT(sub[i]) : 0);
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -480,7 +469,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return tail == subsize;
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**********************************************************************/
|
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1143,8 +1132,8 @@
|
2020-06-02 14:48:24 +00:00
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
-static void
|
|
|
|
-maxcsnode1(int *best, graph *g, setword cliq, setword cov, int maxv)
|
|
|
|
+STATIC_POPCNTFUNC(void,
|
|
|
|
+maxcsnode1,(int *best, graph *g, setword cliq, setword cov, int maxv),
|
|
|
|
/* Internal search node. cov has all the vertices outside cliq that
|
|
|
|
* cover all of cliq. maxv is the last vertex of cliq.
|
|
|
|
* *best is the largest clique known so far.
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1168,7 +1157,7 @@
|
|
|
|
maxcsnode1(best,g,cliq|bit[i],cov&g[i]&~bit[i],i);
|
2020-06-02 14:48:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
int
|
|
|
|
maxcliquesize(graph *g, int m, int n)
|
2016-04-21 22:40:59 +00:00
|
|
|
--- a/gutil2.c
|
|
|
|
+++ b/gutil2.c
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -58,8 +58,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
-long
|
|
|
|
-pathcount1(graph *g, int start, setword body, setword last)
|
|
|
|
+POPCNTFUNC(long,pathcount1,(graph *g, int start, setword body, setword last),
|
|
|
|
/* Number of paths in g starting at start, lying within body and
|
|
|
|
ending in last. {start} and last should be disjoint subsets of body. */
|
|
|
|
{
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -80,7 +79,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return count;
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -124,8 +123,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
-long
|
|
|
|
-indpathcount1(graph *g, int start, setword body, setword last)
|
|
|
|
+POPCNTFUNC(long,indpathcount1,(graph *g, int start, setword body, setword last),
|
|
|
|
/* Number of induced paths in g starting at start, extravertices within
|
|
|
|
* body and ending in last.
|
|
|
|
* {start}, body and last should be disjoint. */
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -146,7 +144,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return count;
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -192,8 +190,7 @@
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
-long
|
|
|
|
-numind3sets1(graph *g, int n)
|
|
|
|
+POPCNTFUNC(long,numind3sets1,(graph *g, int n),
|
|
|
|
/* The number of triangles in g; undirected only */
|
|
|
|
{
|
|
|
|
int i,j;
|
|
|
|
@@ -213,7 +210,7 @@
|
|
|
|
}
|
|
|
|
|
|
|
|
return total;
|
|
|
|
-}
|
|
|
|
+ })
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
@@ -229,8 +226,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
-long
|
|
|
|
-numtriangles1(graph *g, int n)
|
|
|
|
+POPCNTFUNC(long,numtriangles1,(graph *g, int n),
|
2021-09-02 20:09:07 +00:00
|
|
|
/* The number of triangles in g; undirected only */
|
2016-04-21 22:40:59 +00:00
|
|
|
{
|
|
|
|
int i,j;
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -250,12 +246,11 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return total;
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
-long
|
|
|
|
-numtriangles(graph *g, int m, int n)
|
|
|
|
+POPCNTFUNC(long,numtriangles,(graph *g, int m, int n),
|
2021-09-02 20:09:07 +00:00
|
|
|
/* The number of triangles in g; undirected only */
|
2016-04-21 22:40:59 +00:00
|
|
|
{
|
|
|
|
int i,j,k,kw;
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -280,7 +275,7 @@
|
|
|
|
}
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
return total;
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -338,9 +333,8 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
-void
|
|
|
|
-commonnbrs(graph *g, int *minadj, int *maxadj, int *minnon, int *maxnon,
|
|
|
|
- int m, int n)
|
|
|
|
+POPCNTFUNC(void,commonnbrs,
|
|
|
|
+ (graph *g, int *minadj, int *maxadj, int *minnon, int *maxnon, int m, int n),
|
|
|
|
/* Count the common neighbours of pairs of vertices, and give the minimum
|
|
|
|
and maximum for adjacent and non-adjacent vertices. Undirected only.
|
|
|
|
Null minimums are n+1 and null maximums are -1.
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -387,7 +381,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
*maxadj = maxa;
|
|
|
|
*minnon = minn;
|
|
|
|
*maxnon = maxn;
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -456,8 +450,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
static TLS_ATTR int knm[18][16]; /* knm[n,m] = conncontent(K_n - m*K_2) */
|
|
|
|
static TLS_ATTR boolean knm_computed = FALSE;
|
|
|
|
|
|
|
|
-int
|
|
|
|
-conncontent(graph *g, int m, int n)
|
|
|
|
+POPCNTFUNC(int,conncontent,(graph *g, int m, int n),
|
|
|
|
/* number of connected spanning subgraphs with an even number
|
|
|
|
of edges minus the number with an odd number of edges */
|
|
|
|
{
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -608,7 +601,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
v2 = conncontent(h,m,n-1);
|
|
|
|
|
|
|
|
return v1 - v2;
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
boolean
|
|
|
|
stronglyconnected(graph *g, int m, int n)
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -673,8 +666,7 @@
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
-long
|
|
|
|
-numsquares(graph *g, int m, int n)
|
|
|
|
+POPCNTFUNC(long,numsquares,(graph *g, int m, int n),
|
|
|
|
/* Number of 4-cycles. Undirected graphs only, loops ok. */
|
|
|
|
{
|
|
|
|
setword w,bitij;
|
|
|
|
@@ -716,12 +708,11 @@
|
|
|
|
}
|
|
|
|
return (long)(total / 2);
|
|
|
|
}
|
|
|
|
-}
|
|
|
|
+ })
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
-long
|
|
|
|
-numdiamonds(graph *g, int m, int n)
|
|
|
|
+POPCNTFUNC(long,numdiamonds,(graph *g, int m, int n),
|
|
|
|
/* Number of diamonds (squares with diagonal). Undirected only, no loops. */
|
|
|
|
{
|
|
|
|
int i,j,k;
|
|
|
|
@@ -759,4 +750,4 @@
|
|
|
|
}
|
|
|
|
|
|
|
|
return ans;
|
|
|
|
-}
|
|
|
|
+ })
|
2016-04-21 22:40:59 +00:00
|
|
|
--- a/listg.c
|
|
|
|
+++ b/listg.c
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -253,8 +253,8 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
-static void
|
|
|
|
-putve(FILE *f, unsigned long id, graph *g, boolean digraph, int m, int n)
|
|
|
|
+STATIC_POPCNTFUNC(void,putve,
|
|
|
|
+ (FILE *f, unsigned long id, graph *g, boolean digraph, int m, int n),
|
|
|
|
/* Write the numbers of vertices and edges */
|
|
|
|
{
|
|
|
|
unsigned long ne;
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -266,7 +266,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
fprintf(f,"Graph %lu has %d vertices and %lu edges.\n",id,n,
|
|
|
|
(digraph?ne:ne/2));
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -326,8 +326,8 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
-static void
|
2020-06-02 14:48:24 +00:00
|
|
|
-putbliss(FILE *f, unsigned long id, boolean qswitch, graph *g, int m, int n)
|
2016-04-21 22:40:59 +00:00
|
|
|
+STATIC_POPCNTFUNC(void,putbliss,
|
2020-06-02 14:48:24 +00:00
|
|
|
+ (FILE *f, unsigned long id, boolean qswitch, graph *g, int m, int n),
|
2016-04-21 22:40:59 +00:00
|
|
|
/* Write the graph in Bliss format, according to
|
|
|
|
* http://www.tcs.hut.fi/Software/bliss/fileformat.shtml */
|
|
|
|
{
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -347,7 +347,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
for (i = 0, pg = g; i < n; ++i, pg += m)
|
|
|
|
for (j = nextelement(pg,m,i); j >= 0; j = nextelement(pg,m,j))
|
|
|
|
fprintf(f,"e %d %d\n",i+1,j+1);
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -437,9 +437,9 @@
|
2020-06-02 14:48:24 +00:00
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
-static void
|
2022-11-17 20:47:11 +00:00
|
|
|
-putLaplacianMagma(FILE *outfile, graph *g, int linelength, boolean signless,
|
2020-06-02 14:48:24 +00:00
|
|
|
- int m, int n, long index)
|
|
|
|
+STATIC_POPCNTFUNC(void,putLaplacianMagma,
|
2022-11-17 20:47:11 +00:00
|
|
|
+ (FILE *outfile, graph *g, int linelength, boolean signless,
|
|
|
|
+ int m, int n, long index),
|
2020-06-02 14:48:24 +00:00
|
|
|
{
|
2022-11-17 20:47:11 +00:00
|
|
|
int i,j,j0,d,e;
|
2020-06-02 14:48:24 +00:00
|
|
|
set *gi;
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -466,13 +466,13 @@
|
2020-06-02 14:48:24 +00:00
|
|
|
if (i < n-1) fprintf(outfile,",\n");
|
2022-11-17 20:47:11 +00:00
|
|
|
else fprintf(outfile,"]);\n");
|
2020-06-02 14:48:24 +00:00
|
|
|
}
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
-static void
|
2022-11-17 20:47:11 +00:00
|
|
|
-putLaplacianMaple(FILE *outfile, graph *g, int linelength, boolean signless,
|
2020-06-02 14:48:24 +00:00
|
|
|
- int m, int n, long index)
|
|
|
|
+STATIC_POPCNTFUNC(void,putLaplacianMaple,
|
2022-11-17 20:47:11 +00:00
|
|
|
+ (FILE *outfile, graph *g, int linelength, boolean signless,
|
|
|
|
+ int m, int n, long index),
|
2020-06-02 14:48:24 +00:00
|
|
|
{
|
2022-11-17 20:47:11 +00:00
|
|
|
int i,j,d,e;
|
2020-06-02 14:48:24 +00:00
|
|
|
set *gi;
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -508,7 +508,7 @@
|
2020-06-02 14:48:24 +00:00
|
|
|
if (i != n-1) fprintf(outfile,",\n");
|
|
|
|
}
|
|
|
|
fprintf(outfile,"]);\n");
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
/**************************************************************************/
|
2016-04-21 22:40:59 +00:00
|
|
|
--- a/multig.c
|
|
|
|
+++ b/multig.c
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -517,6 +517,18 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
+STATIC_POPCNTFUNC(int __attribute__((pure)),compute_degree,
|
|
|
|
+ (const set *gi, int m),
|
|
|
|
+{
|
|
|
|
+ int i, thisdeg;
|
|
|
|
+
|
|
|
|
+ thisdeg = 0;
|
|
|
|
+ for (i = 0; i < m; ++i) thisdeg += POPCOUNT(gi[i]);
|
|
|
|
+ return thisdeg;
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+/**************************************************************************/
|
|
|
|
+
|
|
|
|
static void
|
|
|
|
multi(graph *g, int nfixed, long minedges, long maxedges, long maxmult,
|
|
|
|
int maxdeg, boolean lswitch, int m, int n)
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -544,8 +556,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
maxd = 0;
|
|
|
|
for (i = 0, gi = g; i < n; ++i, gi += m)
|
|
|
|
{
|
|
|
|
- thisdeg = 0;
|
|
|
|
- for (j = 0; j < m; ++j) thisdeg += POPCOUNT(gi[j]);
|
|
|
|
+ thisdeg = compute_degree(gi, m);
|
|
|
|
deg[i] = thisdeg;
|
|
|
|
if (thisdeg > maxd) maxd = thisdeg;
|
|
|
|
if (thisdeg == 0) lab[++j0] = i;
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -716,8 +727,7 @@
|
|
|
|
maxd = 0;
|
|
|
|
for (i = 0, gi = g; i < n; ++i, gi += m)
|
|
|
|
{
|
|
|
|
- thisdeg = 0;
|
|
|
|
- for (j = 0; j < m; ++j) thisdeg += POPCOUNT(gi[j]);
|
|
|
|
+ thisdeg = compute_degree(gi,m);
|
|
|
|
deg[i] = thisdeg;
|
|
|
|
if (thisdeg > maxd) maxd = thisdeg;
|
|
|
|
if (thisdeg == 0) weight[i] = -i-1;
|
2016-04-21 22:40:59 +00:00
|
|
|
--- a/naugraph.c
|
|
|
|
+++ b/naugraph.c
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -175,16 +175,17 @@ updatecan(graph *g, graph *canong, int *
|
2016-04-21 22:40:59 +00:00
|
|
|
* *
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
+#if MAXM==1
|
|
|
|
void
|
|
|
|
refine(graph *g, int *lab, int *ptn, int level, int *numcells,
|
|
|
|
int *count, set *active, int *code, int m, int n)
|
|
|
|
{
|
|
|
|
-
|
|
|
|
-#if MAXM==1
|
|
|
|
refine1(g,lab,ptn,level,numcells,count,active,code,m,n);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
-
|
|
|
|
+POPCNTFUNC(void,refine,(graph *g, int *lab, int *ptn, int level, int *numcells,
|
|
|
|
+ int *count, set *active, int *code, int m, int n),
|
|
|
|
+{
|
|
|
|
int i,c1,c2,labc1;
|
|
|
|
setword x;
|
|
|
|
set *set1,*set2;
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -194,11 +195,9 @@ refine(graph *g, int *lab, int *ptn, int
|
2016-04-21 22:40:59 +00:00
|
|
|
set *gptr;
|
|
|
|
int maxcell,maxpos,hint;
|
|
|
|
|
|
|
|
-#if !MAXN
|
|
|
|
- DYNALLOC1(int,workperm,workperm_sz,n,"refine");
|
|
|
|
- DYNALLOC1(set,workset,workset_sz,m,"refine");
|
|
|
|
- DYNALLOC1(int,bucket,bucket_sz,n+2,"refine");
|
|
|
|
-#endif
|
|
|
|
+ DEF_DYNINT(workperm,n,"refine");
|
|
|
|
+ DEF_DYNSET(workset,m,"refine");
|
|
|
|
+ DEF_DYNINT(bucket,n+2,"refine");
|
|
|
|
|
|
|
|
longcode = *numcells;
|
|
|
|
split1 = -1;
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -326,7 +325,7 @@ refine(graph *g, int *lab, int *ptn, int
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
longcode = MASH(longcode,*numcells);
|
|
|
|
*code = CLEANUP(longcode);
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
#endif /* else case of MAXM==1 */
|
|
|
|
|
|
|
|
/*****************************************************************************
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -338,9 +337,8 @@ refine(graph *g, int *lab, int *ptn, int
|
2016-04-21 22:40:59 +00:00
|
|
|
* *
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
-void
|
|
|
|
-refine1(graph *g, int *lab, int *ptn, int level, int *numcells,
|
|
|
|
- int *count, set *active, int *code, int m, int n)
|
|
|
|
+POPCNTFUNC(void,refine1,(graph *g, int *lab, int *ptn, int level,
|
|
|
|
+ int *numcells, int *count, set *active, int *code, int m, int n),
|
|
|
|
{
|
|
|
|
int i,c1,c2,labc1;
|
|
|
|
setword x;
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -350,10 +348,8 @@ refine1(graph *g, int *lab, int *ptn, in
|
2016-04-21 22:40:59 +00:00
|
|
|
set *gptr,workset0;
|
|
|
|
int maxcell,maxpos,hint;
|
|
|
|
|
|
|
|
-#if !MAXN
|
|
|
|
- DYNALLOC1(int,workperm,workperm_sz,n,"refine1");
|
|
|
|
- DYNALLOC1(int,bucket,bucket_sz,n+2,"refine1");
|
|
|
|
-#endif
|
|
|
|
+ DEF_DYNINT(workperm,n,"refine1");
|
|
|
|
+ DEF_DYNINT(bucket,n+2,"refine1");
|
|
|
|
|
|
|
|
longcode = *numcells;
|
|
|
|
split1 = -1;
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -476,7 +472,7 @@ refine1(graph *g, int *lab, int *ptn, in
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
longcode = MASH(longcode,*numcells);
|
|
|
|
*code = CLEANUP(longcode);
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* *
|
|
|
|
--- a/nausparse.c
|
|
|
|
+++ b/nausparse.c
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1487,8 +1487,7 @@ copy_sg(sparsegraph *sg1, sparsegraph *s
|
2016-04-21 22:40:59 +00:00
|
|
|
* *
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
-sparsegraph*
|
|
|
|
-nauty_to_sg(graph *g, sparsegraph *sg, int m, int n)
|
|
|
|
+POPCNTFUNC(sparsegraph*,nauty_to_sg,(graph *g, sparsegraph *sg, int m, int n),
|
|
|
|
{
|
|
|
|
int *d,*e;
|
|
|
|
int i,k;
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1526,7 +1525,7 @@ nauty_to_sg(graph *g, sparsegraph *sg, i
|
2016-04-21 22:40:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return sg;
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* *
|
|
|
|
--- a/nautinv.c
|
|
|
|
+++ b/nautinv.c
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -221,6 +221,19 @@
|
|
|
|
}
|
2016-04-21 22:40:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+STATIC_POPCNTFUNC(int __attribute__((pure)),disjoint_edges,
|
|
|
|
+ (const set *ws, const set *gw, int m),
|
|
|
|
+{
|
|
|
|
+ int i,pc;
|
|
|
|
+ setword sw;
|
|
|
|
+
|
|
|
|
+ pc = 0;
|
|
|
|
+ for (i = M; --i >= 0;)
|
|
|
|
+ if ((sw = ws[i] ^ gw[i]) != 0)
|
|
|
|
+ pc += POPCOUNT(sw);
|
|
|
|
+ return pc;
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
/*****************************************************************************
|
|
|
|
* *
|
|
|
|
* quadruples() assigns to each vertex v a value depending on the set of *
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -236,7 +249,6 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
int *invar, int invararg, boolean digraph, int m, int n)
|
|
|
|
{
|
2022-11-17 20:47:11 +00:00
|
|
|
int i,pc;
|
|
|
|
- setword sw;
|
|
|
|
set *gw;
|
|
|
|
int wt;
|
|
|
|
int v,iv,v1,v2,v3;
|
|
|
|
@@ -284,9 +296,7 @@
|
|
|
|
if (wv3 == wv && v3 <= v) continue;
|
|
|
|
wv3 += wv2;
|
|
|
|
gw = GRAPHROW(g,v3,m);
|
2016-04-21 22:40:59 +00:00
|
|
|
- pc = 0;
|
|
|
|
- for (i = M; --i >= 0;)
|
2022-11-17 20:47:11 +00:00
|
|
|
- if ((sw = ws1[i] ^ gw[i]) != 0) pc += POPCOUNT(sw);
|
|
|
|
+ pc = disjoint_edges(ws1,gw,m);
|
|
|
|
wt = (FUZZ1(pc)+wv3) & 077777;
|
2016-04-21 22:40:59 +00:00
|
|
|
wt = FUZZ2(wt);
|
|
|
|
ACCUM(invar[v],wt);
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -315,7 +325,6 @@
|
|
|
|
int *invar, int invararg, boolean digraph, int m, int n)
|
|
|
|
{
|
|
|
|
int i,pc;
|
|
|
|
- setword sw;
|
|
|
|
set *gw;
|
|
|
|
int wt;
|
|
|
|
int v,iv,v1,v2;
|
|
|
|
@@ -355,9 +364,7 @@
|
|
|
|
if (wv2 == wv && v2 <= v) continue;
|
|
|
|
wv2 += wv1;
|
|
|
|
gw = GRAPHROW(g,v2,m);
|
|
|
|
- pc = 0;
|
|
|
|
- for (i = M; --i >= 0;)
|
|
|
|
- if ((sw = workset[i] ^ gw[i]) != 0) pc += POPCOUNT(sw);
|
|
|
|
+ pc = disjoint_edges(workset,gw,m);
|
|
|
|
wt = (FUZZ1(pc)+wv2) & 077777;
|
|
|
|
wt = FUZZ2(wt);
|
|
|
|
ACCUM(invar[v],wt);
|
|
|
|
@@ -382,8 +389,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
adjtriang(graph *g, int *lab, int *ptn, int level, int numcells, int tvpos,
|
|
|
|
int *invar, int invararg, boolean digraph, int m, int n)
|
|
|
|
{
|
2022-11-17 20:47:11 +00:00
|
|
|
- int j,pc;
|
|
|
|
- setword sw;
|
|
|
|
+ int pc;
|
|
|
|
set *gi;
|
|
|
|
int wt;
|
|
|
|
int i,v1,v2;
|
|
|
|
@@ -421,10 +427,8 @@
|
|
|
|
i = -1;
|
|
|
|
while ((i = nextelement(workset,M,i)) >= 0)
|
|
|
|
{
|
|
|
|
- pc = 0;
|
|
|
|
gi = GRAPHROW(g,i,m);
|
|
|
|
- for (j = M; --j >= 0;)
|
|
|
|
- if ((sw = workset[j] & gi[j]) != 0) pc += POPCOUNT(sw);
|
|
|
|
+ pc = disjoint_edges(workset,gi,m);
|
|
|
|
pc = (pc + wt) & 077777;
|
|
|
|
ACCUM(invar[i],pc);
|
|
|
|
}
|
|
|
|
@@ -509,7 +513,6 @@
|
|
|
|
int *invar, int invararg, boolean digraph, int m, int n)
|
|
|
|
{
|
|
|
|
int i,pc;
|
|
|
|
- setword sw;
|
|
|
|
set *gw;
|
|
|
|
int wt;
|
|
|
|
int v,iv,v1,iv1,v2,iv2;
|
|
|
|
@@ -545,10 +548,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
{
|
2022-11-17 20:47:11 +00:00
|
|
|
v2 = lab[iv2];
|
|
|
|
gw = GRAPHROW(g,v2,m);
|
2016-04-21 22:40:59 +00:00
|
|
|
- pc = 0;
|
2022-11-17 20:47:11 +00:00
|
|
|
- for (i = M; --i >= 0;)
|
|
|
|
- if ((sw = workset[i] ^ gw[i]) != 0)
|
|
|
|
- pc += POPCOUNT(sw);
|
|
|
|
+ pc = disjoint_edges(workset,gw,m);
|
|
|
|
wt = FUZZ1(pc);
|
|
|
|
ACCUM(invar[v],wt);
|
|
|
|
ACCUM(invar[v1],wt);
|
|
|
|
@@ -577,7 +577,6 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
int *invar, int invararg, boolean digraph, int m, int n)
|
|
|
|
{
|
2022-11-17 20:47:11 +00:00
|
|
|
int i,pc;
|
|
|
|
- setword sw;
|
|
|
|
set *gw;
|
|
|
|
int wt;
|
|
|
|
int v,iv,v1,iv1,v2,iv2,v3,iv3;
|
|
|
|
@@ -619,10 +618,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
{
|
2022-11-17 20:47:11 +00:00
|
|
|
v3 = lab[iv3];
|
|
|
|
gw = GRAPHROW(g,v3,m);
|
2016-04-21 22:40:59 +00:00
|
|
|
- pc = 0;
|
|
|
|
- for (i = M; --i >= 0;)
|
2022-11-17 20:47:11 +00:00
|
|
|
- if ((sw = ws1[i] ^ gw[i]) != 0)
|
2016-04-21 22:40:59 +00:00
|
|
|
- pc += POPCOUNT(sw);
|
2022-11-17 20:47:11 +00:00
|
|
|
+ pc = disjoint_edges(ws1,gw,m);
|
2016-04-21 22:40:59 +00:00
|
|
|
wt = FUZZ1(pc);
|
|
|
|
ACCUM(invar[v],wt);
|
|
|
|
ACCUM(invar[v1],wt);
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -653,7 +649,6 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
int *invar, int invararg, boolean digraph, int m, int n)
|
|
|
|
{
|
2022-11-17 20:47:11 +00:00
|
|
|
int i,pc;
|
|
|
|
- setword sw;
|
|
|
|
set *gw;
|
|
|
|
int wt;
|
|
|
|
int v,iv,v1,iv1,v2,iv2,v3,iv3,v4,iv4;
|
|
|
|
@@ -701,10 +696,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
{
|
2022-11-17 20:47:11 +00:00
|
|
|
v4 = lab[iv4];
|
|
|
|
gw = GRAPHROW(g,v4,m);
|
2016-04-21 22:40:59 +00:00
|
|
|
- pc = 0;
|
|
|
|
- for (i = M; --i >= 0;)
|
2022-11-17 20:47:11 +00:00
|
|
|
- if ((sw = ws2[i] ^ gw[i]) != 0)
|
2016-04-21 22:40:59 +00:00
|
|
|
- pc += POPCOUNT(sw);
|
2022-11-17 20:47:11 +00:00
|
|
|
+ pc = disjoint_edges(ws2,gw,m);
|
2016-04-21 22:40:59 +00:00
|
|
|
wt = FUZZ1(pc);
|
|
|
|
ACCUM(invar[v],wt);
|
|
|
|
ACCUM(invar[v1],wt);
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -749,6 +741,21 @@
|
|
|
|
return -1;
|
2016-04-21 22:40:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+STATIC_POPCNTFUNC(int __attribute__((pure)),triedges,
|
|
|
|
+ (const set *s0, const set *s1, const set *s2, int m),
|
|
|
|
+{
|
|
|
|
+ int i,pc;
|
|
|
|
+ setword sw;
|
|
|
|
+
|
|
|
|
+ pc = 0;
|
|
|
|
+ for (i = M; --i >= 0;)
|
|
|
|
+ {
|
|
|
|
+ sw = s0[i] & s1[i] & s2[i];
|
|
|
|
+ if (sw) pc += POPCOUNT(sw);
|
|
|
|
+ }
|
|
|
|
+ return pc;
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
/*****************************************************************************
|
|
|
|
* *
|
|
|
|
* cellfano2() assigns to each vertex v a value depending on the set of *
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -765,7 +772,6 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
int *invar, int invararg, boolean digraph, int m, int n)
|
|
|
|
{
|
2022-11-17 20:47:11 +00:00
|
|
|
int i,pc;
|
|
|
|
- setword sw;
|
|
|
|
int wt;
|
|
|
|
int v0,v1,v2,v3,iv0,iv1,iv2,iv3;
|
|
|
|
int icell,bigcells,cell1,cell2;
|
|
|
|
@@ -847,12 +853,7 @@
|
|
|
|
gp1 = GRAPHROW(g,pnt1,m);
|
|
|
|
gp2 = GRAPHROW(g,pnt2,m);
|
|
|
|
|
|
|
|
- pc = 0;
|
|
|
|
- for (i = M; --i >= 0;)
|
|
|
|
- {
|
|
|
|
- sw = gp0[i] & gp1[i] & gp2[i];
|
|
|
|
- if (sw) pc += POPCOUNT(sw);
|
|
|
|
- }
|
|
|
|
+ pc = triedges(gp0,gp1,gp2,m);
|
|
|
|
wt = FUZZ1(pc);
|
|
|
|
ACCUM(invar[v0],wt);
|
|
|
|
ACCUM(invar[v1],wt);
|
|
|
|
@@ -914,7 +915,6 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
int *invar, int invararg, boolean digraph, int m, int n)
|
|
|
|
{
|
2022-11-17 20:47:11 +00:00
|
|
|
int i,pc;
|
|
|
|
- setword sw;
|
|
|
|
int wt;
|
|
|
|
int v0,v1,v2,v3,iv0,iv1,iv2,iv3;
|
|
|
|
int icell,bigcells,cell1,cell2;
|
|
|
|
@@ -989,12 +989,7 @@
|
|
|
|
setnbhd(g,m,n,workset,pt1);
|
|
|
|
for (i = M; --i >= 0;) workset[i] = w02[i] & w13[i];
|
|
|
|
setnbhd(g,m,n,workset,pt2);
|
|
|
|
- pc = 0;
|
|
|
|
- for (i = M; --i >= 0;)
|
|
|
|
- {
|
|
|
|
- sw = pt0[i] & pt1[i] & pt2[i];
|
|
|
|
- if (sw) pc += POPCOUNT(sw);
|
|
|
|
- }
|
|
|
|
+ pc = triedges(pt0,pt1,pt2,m);
|
|
|
|
wt = FUZZ1(pc);
|
|
|
|
ACCUM(invar[v0],wt);
|
|
|
|
ACCUM(invar[v1],wt);
|
|
|
|
@@ -1238,6 +1233,20 @@
|
|
|
|
}
|
2016-04-21 22:40:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+STATIC_POPCNTFUNC(int,common_edges,(set *ns, const set *gv, int m),
|
|
|
|
+{
|
|
|
|
+ int i,pc;
|
|
|
|
+ setword sw;
|
|
|
|
+
|
|
|
|
+ pc = 0;
|
|
|
|
+ for (i = M; --i >= 0;)
|
|
|
|
+ {
|
|
|
|
+ ns[i] = gv[i] & workset[i];
|
|
|
|
+ if ((sw = ns[i]) != 0) pc += POPCOUNT(sw);
|
|
|
|
+ }
|
|
|
|
+ return pc;
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
/*****************************************************************************
|
|
|
|
* *
|
|
|
|
* cellcliq() assigns to each vertex v a value depending on the number of *
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1260,7 +1269,6 @@
|
|
|
|
int *cellstart,*cellsize;
|
|
|
|
int iv,icell,bigcells,cell1,cell2;
|
|
|
|
int pc;
|
|
|
|
- setword sw;
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
#if !MAXN
|
2022-11-17 20:47:11 +00:00
|
|
|
DYNALLOC1(set,workset,workset_sz,m,"cellcliq");
|
|
|
|
@@ -1293,13 +1301,7 @@
|
|
|
|
v[0] = lab[iv];
|
|
|
|
gv = GRAPHROW(g,v[0],m);
|
|
|
|
ns = (set*)wss;
|
|
|
|
- pc = 0;
|
2016-04-21 22:40:59 +00:00
|
|
|
-
|
2022-11-17 20:47:11 +00:00
|
|
|
- for (i = M; --i >= 0;)
|
|
|
|
- {
|
|
|
|
- ns[i] = gv[i] & workset[i];
|
|
|
|
- if ((sw = ns[i]) != 0) pc += POPCOUNT(sw);
|
|
|
|
- }
|
|
|
|
+ pc = common_edges(ns,gv,m);
|
|
|
|
if (pc <= 1 || pc >= cellsize[icell] - 2) continue;
|
|
|
|
|
|
|
|
ss = 1;
|
|
|
|
@@ -1333,6 +1335,20 @@
|
|
|
|
}
|
2016-04-21 22:40:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+STATIC_POPCNTFUNC(int,not_common_edges,(set *ns, const set *gv, int m),
|
|
|
|
+{
|
|
|
|
+ int i,pc;
|
|
|
|
+ setword sw;
|
|
|
|
+
|
|
|
|
+ pc = 0;
|
|
|
|
+ for (i = M; --i >= 0;)
|
|
|
|
+ {
|
|
|
|
+ ns[i] = ~gv[i] & workset[i];
|
|
|
|
+ if ((sw = ns[i]) != 0) pc += POPCOUNT(sw);
|
|
|
|
+ }
|
|
|
|
+ return pc;
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
/*****************************************************************************
|
|
|
|
* *
|
|
|
|
* cellind() assigns to each vertex v a value depending on the number of *
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1389,13 +1405,7 @@
|
|
|
|
v[0] = lab[iv];
|
|
|
|
gv = GRAPHROW(g,v[0],m);
|
|
|
|
ns = (set*)wss;
|
|
|
|
- pc = 0;
|
2016-04-21 22:40:59 +00:00
|
|
|
-
|
2022-11-17 20:47:11 +00:00
|
|
|
- for (i = M; --i >= 0;)
|
|
|
|
- {
|
|
|
|
- ns[i] = ~gv[i] & workset[i];
|
|
|
|
- if ((sw = ns[i]) != 0) pc += POPCOUNT(sw);
|
|
|
|
- }
|
|
|
|
+ pc = not_common_edges(ns,gv,m);
|
|
|
|
if (pc <= 1 || pc >= cellsize[icell] - 2) continue;
|
|
|
|
|
|
|
|
ss = 1;
|
|
|
|
@@ -1554,9 +1564,9 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
* *
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
-static int
|
|
|
|
-semirefine(graph *g, int *lab, int *ptn, int level, int *numcells,
|
|
|
|
- int strength, set *active, int m, int n)
|
|
|
|
+STATIC_POPCNTFUNC(int,semirefine,
|
|
|
|
+ (graph *g, int *lab, int *ptn, int level, int *numcells,
|
|
|
|
+ int strength, set *active, int m, int n),
|
|
|
|
{
|
2022-11-17 20:47:11 +00:00
|
|
|
int i,c1,c2,labc1;
|
|
|
|
setword x;
|
|
|
|
@@ -1567,12 +1577,10 @@
|
|
|
|
set *gptr;
|
|
|
|
int maxcell,maxpos,hint;
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
-#if !MAXN
|
2022-11-17 20:47:11 +00:00
|
|
|
- DYNALLOC1(int,workperm,workperm_sz,n,"refine");
|
|
|
|
- DYNALLOC1(set,workset,workset_sz,m,"refine");
|
|
|
|
- DYNALLOC1(int,bucket,bucket_sz,n+2,"refine");
|
|
|
|
- DYNALLOC1(int,count,count_sz,n,"refine");
|
2016-04-21 22:40:59 +00:00
|
|
|
-#endif
|
2022-11-17 20:47:11 +00:00
|
|
|
+ DEF_DYNINT(workperm,n,"refine");
|
|
|
|
+ DEF_DYNSET(workset,m,"refine");
|
|
|
|
+ DEF_DYNINT(bucket,n+2,"refine");
|
|
|
|
+ DEF_DYNINT(count,n,"refine");
|
2016-04-21 22:40:59 +00:00
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
longcode = *numcells;
|
|
|
|
split1 = -1;
|
|
|
|
@@ -1700,7 +1708,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
longcode = MASH(longcode,FUZZ2(*numcells));
|
|
|
|
return CLEANUP(longcode);
|
2016-04-21 22:40:59 +00:00
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
void
|
|
|
|
refinvar(graph *g, int *lab, int *ptn, int level, int numcells, int tvpos,
|
|
|
|
--- a/naututil.c
|
|
|
|
+++ b/naututil.c
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -134,8 +134,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
* *
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
-int
|
|
|
|
-setinter(set *set1, set *set2, int m)
|
|
|
|
+POPCNTFUNC(int,setinter,(set *set1, set *set2, int m),
|
|
|
|
{
|
|
|
|
setword x;
|
|
|
|
int count,i;
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -149,7 +148,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return count;
|
|
|
|
-}
|
2022-11-17 20:47:11 +00:00
|
|
|
+})
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* *
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -157,8 +156,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
* *
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
-int
|
|
|
|
-setsize(set *set1, int m)
|
|
|
|
+POPCNTFUNC(int,setsize,(set *set1, int m),
|
2022-11-17 20:47:11 +00:00
|
|
|
{
|
2016-04-21 22:40:59 +00:00
|
|
|
int count,i;
|
|
|
|
setword x;
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -169,7 +167,7 @@
|
|
|
|
for (i = m; --i >= 0;) count += POPCOUNT(set1[i]);
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
return count;
|
|
|
|
-}
|
2022-11-17 20:47:11 +00:00
|
|
|
+})
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* *
|
|
|
|
--- a/nauty-h.in
|
|
|
|
+++ b/nauty-h.in
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -88,6 +88,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
#define HAVE_POPCNTLL @have_popcntll@
|
|
|
|
#define HAVE_MMPOP32 @have_mmpop32@
|
|
|
|
#define HAVE_MMPOP64 @have_mmpop64@
|
|
|
|
+#define RUNTIME_POPCNT @runtime_popcnt@
|
|
|
|
|
|
|
|
/*==================================================================*/
|
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -843,6 +844,46 @@
|
2020-06-02 14:48:24 +00:00
|
|
|
|
|
|
|
#ifndef FIRSTBITNZ /* Can be defined outside */
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
+/* Determine popcount support at runtime */
|
|
|
|
+#if RUNTIME_POPCNT
|
|
|
|
+#if !defined(__x86_64__) && !defined(__i386__)
|
|
|
|
+#error Runtime popcount support is only available on x86 or x86_64.
|
|
|
|
+#endif
|
|
|
|
+#ifndef __GNUC__
|
|
|
|
+#error Runtime popcount support is only available with GCC.
|
|
|
|
+#endif
|
2021-01-05 12:38:03 +00:00
|
|
|
+#if !__clang__ && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6))
|
2016-04-21 22:40:59 +00:00
|
|
|
+#error Runtime popcount support is only available with GCC 4.6 or later.
|
|
|
|
+#endif
|
|
|
|
+#include <cpuid.h>
|
|
|
|
+
|
|
|
|
+#define SLOWPOPCNT(type,name,params,...) \
|
|
|
|
+ static type slow_##name params __VA_ARGS__
|
|
|
|
+#define FASTPOPCNT(type,name,params,...) \
|
|
|
|
+ static type __attribute__((target ("popcnt"))) fast_##name params \
|
|
|
|
+ __VA_ARGS__
|
|
|
|
+#define POPCNTHDR(type,name,params,...) \
|
|
|
|
+ SLOWPOPCNT(type,name,params,__VA_ARGS__) \
|
|
|
|
+ FASTPOPCNT(type,name,params,__VA_ARGS__) \
|
2020-06-02 14:48:24 +00:00
|
|
|
+ static type (*resolve_##name (void)) params { \
|
2016-04-21 22:40:59 +00:00
|
|
|
+ unsigned int eax, ebx, ecx, edx; \
|
|
|
|
+ return (__get_cpuid(1, &eax, &ebx, &ecx, &edx) && \
|
|
|
|
+ (ecx & bit_POPCNT) != 0) \
|
2020-06-02 14:48:24 +00:00
|
|
|
+ ? &fast_##name \
|
|
|
|
+ : &slow_##name; \
|
2016-04-21 22:40:59 +00:00
|
|
|
+ }
|
|
|
|
+#define POPCNTFUNC(type,name,params,...) \
|
2020-06-02 14:48:24 +00:00
|
|
|
+ type __attribute__((ifunc ("resolve_" #name))) name params; \
|
|
|
|
+ POPCNTHDR(type,name,params,__VA_ARGS__)
|
2016-04-21 22:40:59 +00:00
|
|
|
+#define STATIC_POPCNTFUNC(type,name,params,...) \
|
2020-06-02 14:48:24 +00:00
|
|
|
+ static type __attribute__((ifunc ("resolve_" #name))) name params; \
|
|
|
|
+ POPCNTHDR(type,name,params,__VA_ARGS__)
|
2016-04-21 22:40:59 +00:00
|
|
|
+#else
|
|
|
|
+#define POPCNTFUNC(type,name,params,...) type name params __VA_ARGS__
|
|
|
|
+#define STATIC_POPCNTFUNC(type,name,params,...) \
|
|
|
|
+ static type name params __VA_ARGS__
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
#ifdef NAUTY_IN_MAGMA
|
2020-06-02 14:48:24 +00:00
|
|
|
#define FIRSTBITNZ(x) bs_firstbit(x)
|
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -955,7 +996,7 @@
|
2020-06-02 14:48:24 +00:00
|
|
|
/* Note that, unlike icc, gcc will not use the POPCNT instruction
|
2022-11-17 20:47:11 +00:00
|
|
|
without permission, in which case it defines __POPCNT__
|
|
|
|
except on Apple M1 hardware. */
|
|
|
|
-#elif defined(__POPCNT__) || IS_ARM64
|
|
|
|
+#elif defined(__POPCNT__) || IS_ARM64 || RUNTIME_POPCNT
|
2020-06-02 14:48:24 +00:00
|
|
|
#if defined(SETWORD_LONGLONG) && HAVE_POPCNTLL
|
|
|
|
#define POPCOUNT(x) __builtin_popcountll(x)
|
|
|
|
#elif defined(SETWORD_LONG) && HAVE_POPCNTL
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1216,6 +1257,25 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
#define CONDYNFREE(name,name_sz,minsz) \
|
|
|
|
if (name_sz > (size_t)(minsz)) {DYNFREE(name,name_sz);}
|
|
|
|
|
|
|
|
+#if MAXN
|
|
|
|
+#define DCL_DYNINT(var) int var[MAXN]
|
|
|
|
+#define DCL_DYNSET(var) setword var[MAXM]
|
|
|
|
+#define DEF_DYNINT(var,n,name)
|
|
|
|
+#define DEF_DYNSET(var,n,name)
|
|
|
|
+#else
|
|
|
|
+#define DCL_DYNINT(var) DYNALLSTAT(int,var,var##_sz)
|
|
|
|
+#define DCL_DYNSET(var) DYNALLSTAT(set,var,var##_sz)
|
|
|
|
+#define DEF_DYNINT(var,n,name) DYNALLOC1(int,var,var##_sz,n,name)
|
|
|
|
+#define DEF_DYNSET(var,n,name) DYNALLOC1(set,var,var##_sz,n,name)
|
|
|
|
+#endif
|
2022-11-17 20:47:11 +00:00
|
|
|
+#if MAXM
|
|
|
|
+#define DCL_DYNSETWORD(var) setword var[MAXM+1]
|
|
|
|
+#define DEF_DYNSETWORD(var,n,name)
|
|
|
|
+#else
|
|
|
|
+#define DCL_DYNSETWORD(var) DYNALLSTAT(setword,var,var##_sz)
|
|
|
|
+#define DEF_DYNSETWORD(var,n,name) DYNALLOC1(setword,var,var##_sz,n,name)
|
|
|
|
+#endif
|
2016-04-21 22:40:59 +00:00
|
|
|
+
|
|
|
|
/* File to write error messages to (used as first argument to fprintf()). */
|
|
|
|
#define ERRFILE stderr
|
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
--- a/nbrhoodg.c
|
|
|
|
+++ b/nbrhoodg.c
|
|
|
|
@@ -54,6 +54,15 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
+STATIC_POPCNTFUNC(int,compute_degree,(setword *gv, int m),
|
|
|
|
+{
|
|
|
|
+ int i, degv = 0;
|
|
|
|
+ for (i = 0; i < m; ++i) degv += POPCOUNT(gv[i]);
|
|
|
|
+ return degv;
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+/**************************************************************************/
|
|
|
|
+
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
@@ -195,8 +204,7 @@
|
|
|
|
for (v = minvert, gv = GRAPHROW(g,minvert,m);
|
|
|
|
v < n && v <= maxvert; ++v, gv += m)
|
|
|
|
{
|
|
|
|
- degv = 0;
|
|
|
|
- for (i = 0; i < m; ++i) degv += POPCOUNT(gv[i]);
|
|
|
|
+ degv = compute_degree(gv,m);
|
|
|
|
if (degv < mindeg || degv > maxdeg) continue;
|
|
|
|
|
|
|
|
if (Cswitch)
|
|
|
|
--- a/vcolg.c
|
|
|
|
+++ b/vcolg.c
|
|
|
|
@@ -144,6 +144,22 @@
|
|
|
|
if (col[i] == 1) DELELEMENT(gi,i);
|
|
|
|
}
|
|
|
|
|
2016-04-21 22:40:59 +00:00
|
|
|
+#ifndef OUTPROC
|
|
|
|
+STATIC_POPCNTFUNC(size_t __attribute__((pure)),compute_degree,
|
|
|
|
+(const graph *g, int m, int n),
|
|
|
|
+{
|
|
|
|
+ const graph *gi;
|
|
|
|
+ size_t ne;
|
|
|
|
+
|
|
|
|
+ ne = 0;
|
|
|
|
+ for (gi = g + m*(size_t)n; --gi >= g; )
|
|
|
|
+ ne += POPCOUNT(*gi);
|
2020-06-02 14:48:24 +00:00
|
|
|
+ return ne;
|
2016-04-21 22:40:59 +00:00
|
|
|
+})
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+/**************************************************************************/
|
|
|
|
+
|
|
|
|
static int
|
2020-06-02 14:48:24 +00:00
|
|
|
trythisone(grouprec *group, graph *g, boolean digraph, int m, int n)
|
2016-04-21 22:40:59 +00:00
|
|
|
/* Try one solution, accept if maximal. */
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -192,9 +208,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
#ifdef OUTPROC
|
|
|
|
OUTPROC(outfile,g,col,m,n);
|
|
|
|
#else
|
2022-11-17 20:47:11 +00:00
|
|
|
- ne = 0;
|
|
|
|
- for (gi = g + m*(size_t)n; --gi >= g; )
|
|
|
|
- ne += POPCOUNT(*gi);
|
|
|
|
+ ne = compute_degree(g,m,n);
|
|
|
|
if (!digraph)
|
|
|
|
{
|
|
|
|
for (i = 0, gi = g; i < n; ++i, gi += m)
|
|
|
|
@@ -542,10 +556,24 @@
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
+STATIC_POPCNTFUNC(void,update_degree,(graph *g, long *deg, int m, int n),
|
|
|
|
+{
|
|
|
|
+ graph *gi;
|
|
|
|
+ int i, j;
|
|
|
|
+
|
|
|
|
+ for (i = 0, gi = g; i < n; ++i, gi += m)
|
|
|
|
+ {
|
|
|
|
+ deg[i] = 0;
|
|
|
|
+ for (j = 0; j < m; ++j) deg[i] += POPCOUNT(gi[j]);
|
|
|
|
+ }
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+/**************************************************************************/
|
|
|
|
+
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
- graph *g,*gi;
|
|
|
|
+ graph *g;
|
|
|
|
int m,n,codetype;
|
|
|
|
int argnum,i,j,nfixed;
|
|
|
|
char *arg,sw;
|
|
|
|
@@ -753,11 +781,7 @@
|
|
|
|
if (oswitch && loopcount(g,m,n) > 0)
|
|
|
|
gt_abort(">E vcolg: loops in input are not allowed for -o\n");
|
|
|
|
|
|
|
|
- for (i = 0, gi = g; i < n; ++i, gi += m)
|
|
|
|
- {
|
|
|
|
- deg[i] = 0;
|
|
|
|
- for (j = 0; j < m; ++j) deg[i] += POPCOUNT(gi[j]);
|
|
|
|
- }
|
|
|
|
+ update_degree(g,deg,m,n);
|
|
|
|
|
|
|
|
if (!digraph)
|
|
|
|
colourgraph(g,nfixed,mincols,maxcols,colcount,
|
2016-04-21 22:40:59 +00:00
|
|
|
--- a/watercluster2.c
|
|
|
|
+++ b/watercluster2.c
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -593,7 +593,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
/****************************************INIT_FOR_G6*****************************/
|
|
|
|
|
|
|
|
-void init_for_g6(graph g[],int aantal_toppen, int degree[])
|
|
|
|
+STATIC_POPCNTFUNC(void,init_for_g6,(graph g[],int aantal_toppen, int degree[]),
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -605,7 +605,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
aantal_gerichte_bogen=0;
|
|
|
|
return;
|
|
|
|
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
|
|
|
|
/***************************FILL_EDGELIST**************************/
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1238,7 +1238,8 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
/**********************************CONSTRUCT_EXTENSIONS**************************/
|
|
|
|
|
|
|
|
-void construct_extensions(int still_open[], int orbit[], graph touched, int first_in_orbit, graph sameorbit)
|
|
|
|
+STATIC_POPCNTFUNC(void,construct_extensions,
|
|
|
|
+ (int still_open[], int orbit[], graph touched, int first_in_orbit, graph sameorbit),
|
|
|
|
{
|
|
|
|
int top, top2, j, end, list[MAXN], decided[MAXN], error, lowerlimit_outdeg, readylist[MAXN], *readyrun, dummy;
|
|
|
|
int minout, do_double=0, i, mindouble;
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1398,7 +1399,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
int compare_op(unsigned char *op1, unsigned char *op2)
|
|
|
|
// returns 0 if operations are the same, something negative if op1
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1525,7 +1526,8 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
/******************************CANONICAL****************************/
|
|
|
|
|
|
|
|
-int canonical(unsigned char operation[], int vertexorbit[], int *newgroup, int orbitid, graph touched)
|
|
|
|
+STATIC_POPCNTFUNC(int,canonical,
|
|
|
|
+ (unsigned char operation[], int vertexorbit[], int *newgroup, int orbitid, graph touched),
|
|
|
|
|
|
|
|
// checks whether the operation is canonical in vertexorbit. Returns 1 if yes, 0 otherwise.
|
|
|
|
// In newgroup it is stored whether a new group has been computed for this (*newgroup=1) or not
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -1822,7 +1824,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
else { return 0; }
|
|
|
|
|
|
|
|
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
int all_diff_colours(graph testset, int orbitid)
|
|
|
|
// returns 1 if all elements have some different vertex invariant and 0 otherwise
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -3764,7 +3766,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-void waterclusters (graph g[], int n)
|
|
|
|
+STATIC_POPCNTFUNC(void,waterclusters,(graph g[], int n),
|
|
|
|
{
|
|
|
|
int i, j, k, orbitsize, start, end, fixed_edge, dummy, maxgraphdeg, biggest_orbit;
|
|
|
|
BOOG kleinste_orbit[MAX_BOGEN+1]; /* het is mogelijk dat er maar 1 orbit is */
|
2022-11-17 20:47:11 +00:00
|
|
|
@@ -3927,7 +3929,7 @@
|
2016-04-21 22:40:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
-}
|
|
|
|
+})
|
|
|
|
|
|
|
|
|
|
|
|
|