30#include "nauty/nausparse.h"
37 void (*
staticfhook)(
void*,
unsigned int,
const unsigned int*);
54 std::vector<std::vector<int>>
edges;
82 graphdata->scip_ =
scip;
84 options.defaultptn =
FALSE;
85 SG_INIT(graphdata->graph);
86 DYNALLOC1(
size_t, graphdata->graph.v, graphdata->graph.vlen, nvertices,
"malloc");
87 DYNALLOC1(
int, graphdata->graph.d, graphdata->graph.dlen, nvertices,
"malloc");
88 graphdata->graph.e =
NULL;
89 graphdata->graph.w =
NULL;
90 graphdata->graph.nv = nvertices;
92 graphdata->edges.resize(nvertices);
93 graphdata->nedges = 0;
101 SG_FREE(graphdata->graph);
106void struct_graph::setColor(
111 assert(vertex < graphdata->graph.nv);
112 graphdata->ptn[vertex] = color;
115void struct_graph::addEdge(
120 assert(v1 < (
int) graphdata->edges.size() && v2 < (
int) graphdata->edges.size());
121 graphdata->edges[v1].push_back(v2);
122 graphdata->edges[v2].push_back(v1);
123 graphdata->nedges+=2;
126unsigned int struct_graph::getNVertices(
129 return graphdata->graph.nv;
134 void (*
fhook)(
void*,
unsigned int,
const unsigned int*),
135 unsigned int searchnodelimit,
136 unsigned int generatorlimit
142 size_t edgeindex = 0;
145 DYNALLOC1(
int, graphdata->graph.e, graphdata->graph.elen, graphdata->nedges,
"malloc");
146 graphdata->graph.nde = graphdata->nedges;
147 assert((
int) graphdata->edges.size() == graphdata->graph.nv);
148 for(
i = 0;
i < graphdata->graph.nv; ++
i)
150 graphdata->graph.d[
i] = (int)graphdata->edges[
i].size();
151 graphdata->graph.v[
i] = edgeindex;
152 for(
auto v : graphdata->edges[
i] )
154 assert(edgeindex < graphdata->graph.nde);
155 graphdata->graph.e[edgeindex++] = v;
161 for(
i = 0;
i < graphdata->graph.nv; ++
i )
164 for(
i = 0;
i < graphdata->graph.nv; ++
i )
166 if(
i + 1 == graphdata->graph.nv || graphdata->ptn[
i] != graphdata->ptn[
i+1] )
167 graphdata->ptn[
i] = 0;
169 graphdata->ptn[
i] = 1;
178 sparsenauty(&graphdata->graph, lab, graphdata->ptn, orbits, &options, &graphdata->stats,
NULL);
186void struct_graph::terminateSearch()
194 SCIPsnprintf(buffer, len,
"Nauty %d.%d.%d", NAUTYVERSIONID/10000, (NAUTYVERSIONID%10000)/1000, (NAUTYVERSIONID%1000)/10);
static void fhook(void *user_param, unsigned int N, const unsigned int *aut)
static TLS_ATTR DEFAULTOPTIONS_SPARSEGRAPH(options)
static TLS_ATTR NautyData nautydata
void GCGgetNautyName(char *buffer, int len)
static void nautyhook(int count, int *perm, int *orbits, int numorbits, int stabvertex, int n)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
void SCIPsortIntInt(int *intarray1, int *intarray2, int len)
int SCIPsnprintf(char *t, int len, const char *s,...)
static assert(heur !=NULL)
SCIP_CALL(SCIPgetExternBranchCands(origprob, &lpcands, &lpcandssol, NULL, &nlpcands, NULL, NULL, NULL, NULL))
SCIPfreeBufferArray(scip, &cycles)
helper functions for automorphism detection
void(*) staticfhook(void *, unsigned int, const unsigned int *)
unsigned int generatorlimit
unsigned int searchnodelimit
std::vector< std::vector< int > > edges
enum SCIP_Retcode SCIP_RETCODE