45#ifndef __SCIP_HYPERGRAPH_H__
46#define __SCIP_HYPERGRAPH_H__
68 size_t sizevertexdata,
70 size_t sizeoverlapdata
198 unsigned int minoverlapsize,
455#define SCIPhypergraphGetNVertices(hypergraph) ((hypergraph)->nvertices)
456#define SCIPhypergraphGetNEdges(hypergraph) ((hypergraph)->nedges)
457#define SCIPhypergraphBlkmem(hypergraph) ((hypergraph)->blkmem)
458#define SCIPhypergraphGetNOverlaps(hypergraph) ((hypergraph)->noverlaps)
459#define SCIPhypergraphGetNIncidences(hypergraph) ((hypergraph)->edgesverticesbeg[(hypergraph)->nedges])
460#define SCIPhypergraphVertexData(hypergraph,vertex) \
461 ((SCIP_HYPERGRAPH_VERTEXDATA*)((hypergraph)->verticesdata + ((vertex) * ((hypergraph)->sizevertexdata) / sizeof(*((hypergraph)->verticesdata)) )))
462#define SCIPhypergraphEdgeData(hypergraph,edge) \
463 ((SCIP_HYPERGRAPH_EDGEDATA*)((hypergraph)->edgesdata + ((edge) * (hypergraph)->sizeedgedata / sizeof(*((hypergraph)->edgesdata)) )))
464#define SCIPhypergraphOverlapData(hypergraph,overlap) ((SCIP_HYPERGRAPH_OVERLAPDATA*)((hypergraph)->overlapsdata \
465 + ((overlap) * (hypergraph)->sizeoverlapdata / sizeof(*((hypergraph)->overlapsdata)) )))
466#define SCIPhypergraphEdgeSize(hypergraph,edge) ((hypergraph)->edgesverticesbeg[(edge) + 1] \
467 - (hypergraph)->edgesverticesbeg[edge])
468#define SCIPhypergraphEdgeVertices(hypergraph, edge) (&(hypergraph)->edgesvertices[(hypergraph)->edgesverticesbeg[edge]])
469#define SCIPhypergraphHasVertexEdges(hypergraph) ((hypergraph)->hasvertexedges)
470#define SCIPhypergraphVertexEdgesFirst(hypergraph,vertex) ((hypergraph)->verticesedgesbeg[vertex])
471#define SCIPhypergraphVertexEdgesBeyond(hypergraph,vertex) ((hypergraph)->verticesedgesbeg[(vertex) + 1])
472#define SCIPhypergraphVertexEdgesGetAtIndex(hypergraph,index) ((hypergraph)->verticesedges[index])
473#define SCIPhypergraphHasOverlaps(hypergraph) ((hypergraph)->hasoverlaps)
474#define SCIPhypergraphOverlapSize(hypergraph,overlap) ((hypergraph)->overlapsverticesbeg[(overlap) + 1] \
475 - (hypergraph)->overlapsverticesbeg[overlap])
476#define SCIPhypergraphOverlapVertices(hypergraph,overlap) \
477 (&(hypergraph)->overlapsvertices[(hypergraph)->overlapsverticesbeg[overlap]])
478#define SCIPhypergraphEdgesOverlapsFirst(hypergraph,edge) ((hypergraph)->edgesoverlapsbeg[edge])
479#define SCIPhypergraphEdgesOverlapsBeyond(hypergraph,edge) ((hypergraph)->edgesoverlapsbeg[(edge) + 1])
480#define SCIPhypergraphEdgesOverlapsGetAtIndex(hypergraph,index) ((hypergraph)->edgesoverlaps[index])
481#define SCIPhypergraphHasOverlapsEdges(hypergraph) ((hypergraph)->hasoverlapsedges)
482#define SCIPhypergraphOverlapsEdgesFirst(hypergraph,overlap) ((hypergraph)->overlapsedgesbeg[overlap])
483#define SCIPhypergraphOverlapsEdgesBeyond(hypergraph,overlap) ((hypergraph)->overlapsedgesbeg[(overlap) + 1])
484#define SCIPhypergraphOverlapsEdgesGetAtIndex(hypergraph,index) ((hypergraph)->overlapsedges[index])
485#define SCIPhypergraphHasVertexOverlaps(hypergraph) ((hypergraph)->hasverticesoverlaps)
486#define SCIPhypergraphVertexOverlapsFirst(hypergraph,vertex) ((hypergraph)->verticesoverlapsbeg[vertex])
487#define SCIPhypergraphVertexOverlapsBeyond(hypergraph,vertex) ((hypergraph)->verticesoverlapsbeg[(vertex) + 1])
488#define SCIPhypergraphVertexOverlapsGet(hypergraph,index) ((hypergraph)->verticesoverlaps[index])
void SCIPhypergraphIterStart(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_ITER *iterator, SCIP_HYPERGRAPH_EDGE base, unsigned int minoverlapsize, SCIP_Bool onlylater, SCIP_Bool findoverlaps)
initializes the iterator to the first adjacent edge of base
int SCIPhypergraphEdgesOverlapsBeyond(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_EDGE edge)
returns an index beyond the last overlap incident to edge
void SCIPhypergraphIterNext(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_ITER *iterator)
initializes the iterator to the first adjacent edge of base
SCIP_RETCODE SCIPhypergraphFree(SCIP_HYPERGRAPH **phypergraph)
frees a hypergraph
SCIP_HYPERGRAPH_EDGE SCIPhypergraphIterAdjacent(SCIP_HYPERGRAPH_ITER *iterator)
returns the current adjacent edge
SCIP_HYPERGRAPH_EDGE SCIPhypergraphIterBase(SCIP_HYPERGRAPH_ITER *iterator)
returns the base edge
SCIP_RETCODE SCIPhypergraphAddEdge(SCIP_HYPERGRAPH *hypergraph, int nvertices, SCIP_HYPERGRAPH_VERTEX *vertices, SCIP_HYPERGRAPH_EDGE *pedge, SCIP_HYPERGRAPH_EDGEDATA **pedgedata)
adds a new edge to the hypergraph
SCIP_HYPERGRAPH_OVERLAP SCIPhypergraphIterOverlap(SCIP_HYPERGRAPH_ITER *iterator)
returns the overlap for the intersection of the base and the current adjacent edge
int SCIPhypergraphOverlapsEdgesBeyond(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_OVERLAP overlap)
returns an index beyond the last edge incident to overlap
void SCIPhypergraphIterClear(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_ITER *iterator)
frees a hypergraph iterator's internal memory
SCIP_HYPERGRAPH_EDGE SCIPhypergraphVertexEdgesGetAtIndex(SCIP_HYPERGRAPH *hypergraph, int idx)
returns the edge corresponding to index that is incident to a vertex
int SCIPhypergraphVertexEdgesBeyond(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_VERTEX vertex)
returns an index beyond the last edge incident to vertex
SCIP_RETCODE SCIPhypergraphIntersectEdges(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_EDGE first, SCIP_HYPERGRAPH_EDGE second, SCIP_HYPERGRAPH_OVERLAP *poverlap, SCIP_HYPERGRAPH_VERTEX *pvertex)
finds the overlap or singleton vertex corresponding to the intersection of edges first and second
SCIP_Bool SCIPhypergraphIterValid(SCIP_HYPERGRAPH_ITER *iterator)
returns whether the iterator is valid
int SCIPhypergraphGetNEdges(SCIP_HYPERGRAPH *hypergraph)
returns the number of edges
int SCIPhypergraphVertexOverlapsBeyond(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_VERTEX vertex)
returns an index beyond the last overlap incident to vertex
SCIP_RETCODE SCIPhypergraphComputeVerticesEdges(SCIP_HYPERGRAPH *hypergraph)
computes each vertex' list of incident edges
SCIP_HYPERGRAPH_OVERLAPDATA * SCIPhypergraphOverlapData(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_OVERLAP overlap)
returns additional data of overlap
SCIP_RETCODE SCIPhypergraphAddVertex(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_VERTEX *pvertex, SCIP_HYPERGRAPH_VERTEXDATA **pvertexdata)
adds a new vertex to the hypergraph
int SCIPhypergraphEdgeSize(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_EDGE edge)
returns the number of vertices of edge
SCIP_Bool SCIPhypergraphHasOverlapsEdges(SCIP_HYPERGRAPH *hypergraph)
returns whether overlaps' incident edges are known.
SCIP_Bool SCIPhypergraphOverlapsDisjoint(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_OVERLAP overlap1, SCIP_HYPERGRAPH_OVERLAP overlap2)
returns whether overlaps overlap1 and overlap2 are disjoint
SCIP_Bool SCIPhypergraphIsValid(SCIP_HYPERGRAPH *hypergraph, FILE *file)
asserts that the hypergraph data structures are valid
SCIP_RETCODE SCIPhypergraphOverlapFind(SCIP_HYPERGRAPH *hypergraph, int nvertices, SCIP_HYPERGRAPH_VERTEX *vertices, SCIP_HYPERGRAPH_OVERLAP *poverlap)
finds the overlap corresponding to vertex set vertices; returns -1 if it is not found
SCIP_RETCODE SCIPhypergraphClear(SCIP_HYPERGRAPH *hypergraph)
clears a hypergraph, deleting all vertices and edges
SCIP_Bool SCIPhypergraphHasOverlaps(SCIP_HYPERGRAPH *hypergraph)
returns whether edges' overlaps and overlaps' vertices are known.
SCIP_Bool SCIPhypergraphHasVertexOverlaps(SCIP_HYPERGRAPH *hypergraph)
returns whether vertices' incident overlaps are known
SCIP_HYPERGRAPH_VERTEX * SCIPhypergraphEdgeVertices(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_EDGE edge)
returns the array of vertices of edge
int SCIPhypergraphEdgesOverlapsFirst(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_EDGE edge)
returns an index for the first overlap incident to edge
int SCIPhypergraphOverlapsEdgesFirst(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_OVERLAP overlap)
returns an index for the first edge incident to overlap
SCIP_HYPERGRAPH_VERTEX SCIPhypergraphIterMinVertex(SCIP_HYPERGRAPH_ITER *iterator)
returns the minimum vertex in the intersection of the base and the current adjacent edge
SCIP_HYPERGRAPH_VERTEXDATA * SCIPhypergraphVertexData(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_VERTEX vertex)
returns additional data of vertex
SCIP_HYPERGRAPH_OVERLAP SCIPhypergraphVertexOverlapsGetAtIndex(SCIP_HYPERGRAPH *hypergraph, int idx)
returns the overlap corresponding to index that is incident to a vertex
int SCIPhypergraphVertexOverlapsFirst(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_VERTEX vertex)
returns an index for the first overlap containing vertex
SCIP_RETCODE SCIPhypergraphComputeOverlapsEdges(SCIP_HYPERGRAPH *hypergraph)
computes all overlaps' lists of incident edges
SCIP_HYPERGRAPH_OVERLAP SCIPhypergraphOverlapsEdgesGetAtIndex(SCIP_HYPERGRAPH *hypergraph, int idx)
returns the edge corresponding to index that is incident to an overlap
SCIP_RETCODE SCIPhypergraphComputeOverlaps(SCIP_HYPERGRAPH *hypergraph, SCIP_DECL_HYPERGRAPH_OVERLAP((*handler)), void *userdata)
computes all overlaps and stores overlaps' vertices and all edges' overlaps
SCIP_RETCODE SCIPhypergraphComputeVerticesOverlaps(SCIP_HYPERGRAPH *hypergraph)
computes all vertices' lists of incident overlaps
int SCIPhypergraphGetNIncidences(SCIP_HYPERGRAPH *hypergraph)
returns the number of vertex-edge incidences.
SCIP_Bool SCIPhypergraphHasVertexEdges(SCIP_HYPERGRAPH *hypergraph)
returns whether vertices' incident edges are known.
int SCIPhypergraphGetNVertices(SCIP_HYPERGRAPH *hypergraph)
returns the number of vertices
SCIP_HYPERGRAPH_OVERLAP SCIPhypergraphEdgesOverlapsGetAtIndex(SCIP_HYPERGRAPH *hypergraph, int idx)
returns the overlap corresponding to index that is incident to an edge
SCIP_RETCODE SCIPhypergraphIterInit(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_ITER *iterator)
initializes a hypergraph iterator's internal memory
int SCIPhypergraphVertexEdgesFirst(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_VERTEX vertex)
returns an index for the first edge incident to vertex
SCIP_HYPERGRAPH_VERTEX * SCIPhypergraphOverlapVertices(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_OVERLAP overlap)
returns the array of sorted vertices of overlap
int SCIPhypergraphOverlapSize(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_OVERLAP overlap)
returns the number of vertices of overlap
int SCIPhypergraphGetNOverlaps(SCIP_HYPERGRAPH *hypergraph)
returns the number of overlaps
SCIP_HYPERGRAPH_EDGEDATA * SCIPhypergraphEdgeData(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_EDGE edge)
returns additional data of edge
BMS_BLKMEM * SCIPhypergraphBlkmem(SCIP_HYPERGRAPH *hypergraph)
returns the hypergraph's block memory structure
SCIP_RETCODE SCIPhypergraphCreate(SCIP_HYPERGRAPH **phypergraph, BMS_BLKMEM *blkmem, int memvertices, int memedges, int memoverlaps, int memedgesvertices, size_t sizevertexdata, size_t sizeedgedata, size_t sizeoverlapdata)
creates a hypergraph
memory allocation routines
struct BMS_BlkMem BMS_BLKMEM
datastructures hypergraphs
type definitions for hypergraphs
int SCIP_HYPERGRAPH_OVERLAP
struct SCIP_Hypergraph SCIP_HYPERGRAPH
struct SCIP_Hypergraph_Iter SCIP_HYPERGRAPH_ITER
struct SCIP_Hypergraph_OverlapData SCIP_HYPERGRAPH_OVERLAPDATA
struct SCIP_Hypergraph_NodeData SCIP_HYPERGRAPH_VERTEXDATA
#define SCIP_DECL_HYPERGRAPH_OVERLAP(x)
int SCIP_HYPERGRAPH_VERTEX
struct SCIP_Hypergraph_EdgeData SCIP_HYPERGRAPH_EDGEDATA
type definitions for return codes for SCIP methods
enum SCIP_Retcode SCIP_RETCODE