Scippy

SCIP

Solving Constraint Integer Programs

hypergraph.h
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the program and library */
4/* SCIP --- Solving Constraint Integer Programs */
5/* */
6/* Copyright (c) 2002-2025 Zuse Institute Berlin (ZIB) */
7/* */
8/* Licensed under the Apache License, Version 2.0 (the "License"); */
9/* you may not use this file except in compliance with the License. */
10/* You may obtain a copy of the License at */
11/* */
12/* http://www.apache.org/licenses/LICENSE-2.0 */
13/* */
14/* Unless required by applicable law or agreed to in writing, software */
15/* distributed under the License is distributed on an "AS IS" BASIS, */
16/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17/* See the License for the specific language governing permissions and */
18/* limitations under the License. */
19/* */
20/* You should have received a copy of the Apache-2.0 license */
21/* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22/* */
23/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24
25/**@file hypergraph.h
26 * @ingroup INTERNALAPI
27 * @brief Internal methods for dealing with hypergraphs
28 * @author Matthias Walter
29 *
30 * A <em>hypergraph</em> \f$ G \f$ is a pair \f$ (V,E) \f$ of <em>vertices</em> \f$ v \in V \f$ and
31 * <em>(hyper-)edges</em> \f$ e \in E \f$ such that \f$ e \subseteq V \f$ holds. We say that a vertex \f$ v \f$ and an
32 * edge \f$ e \f$ are <em>incident</em> if \f$ v \in e \f$ holds.
33 * A subset \f$ U \subseteq V \f$ is called an <em>overlap set</em> if it is a nontrivial intersection of two distinct
34 * edges, i.e., if \f$ U = e \cap f \f$ for \f$ e,f \in E \f$ and \f$ |U| \geq 2 \f$. In this case, we say that
35 * \f$ U \f$ and \f$ e \f$ are <em>incident</em> (same for \f$ f \f$. We denote the set of overlap sets by
36 * \f$ \mathcal{U} \f$.
37 *
38 * A \ref SCIP_HYPERGRAPH struct defines such a hypergraph \f$ G = (V,E) \f$, potentially with the set
39 * \f$ \mathcal{U} \f$ of overlaps. Efficient access for retrieving elements is provided, e.g., the vertices incident
40 * to an edge, the edges incident to a vertex, or the edges incident to an overlap.
41 */
42
43/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
44
45#ifndef __SCIP_HYPERGRAPH_H__
46#define __SCIP_HYPERGRAPH_H__
47
48#include "scip/type_retcode.h"
51
52#ifdef NDEBUG
54#endif
55
56#ifdef __cplusplus
57extern "C" {
58#endif
59
60/** @brief creates a hypergraph */
62 SCIP_HYPERGRAPH** phypergraph, /**< Pointer for storing the hypergraph. */
63 BMS_BLKMEM* blkmem, /**< Block memory for storage. */
64 int memvertices, /**< Upper bound on expected number of vertices. */
65 int memedges, /**< Upper bound on expected number of edges. */
66 int memoverlaps, /**< Upper bound on expected number of overlaps. */
67 int memedgesvertices, /**< Upper bound on expected average size of edges. */
68 size_t sizevertexdata, /**< Size (in bytes) of additional vertex data. */
69 size_t sizeedgedata, /**< Size (in bytes) of additional edge data. */
70 size_t sizeoverlapdata /**< Size (in bytes) of additional overlap data. */
71 );
72
73/** @brief frees a hypergraph */
75 SCIP_HYPERGRAPH** phypergraph /**< Pointer to the hypergraph. */
76 );
77
78/** @brief clears a hypergraph, deleting all vertices and edges */
80 SCIP_HYPERGRAPH* hypergraph /**< The hypergraph. */
81 );
82
83/** @brief adds a new vertex to the hypergraph */
85 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph. */
86 SCIP_HYPERGRAPH_VERTEX* pvertex, /**< Pointer for storing the new vertex. */
87 SCIP_HYPERGRAPH_VERTEXDATA** pvertexdata /**< Pointer for returning the vertex's data (may be \c NULL). */
88 );
89
90/**
91 * @brief adds a new edge to the hypergraph
92 *
93 * Does not update the vertices' or overlaps' lists of incident edges.
94 */
96 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph. */
97 int nvertices, /**< Number of vertices of this edge. */
98 SCIP_HYPERGRAPH_VERTEX* vertices, /**< Array with vertices. */
99 SCIP_HYPERGRAPH_EDGE* pedge, /**< Pointer for storing the new edge. */
100 SCIP_HYPERGRAPH_EDGEDATA** pedgedata /**< Pointer for returning the edge's data (may be \c NULL). */
101 );
102
103/** @brief computes each vertex' list of incident edges */
105 SCIP_HYPERGRAPH* hypergraph /**< The hypergraph. */
106 );
107
108/**
109 * @brief computes all overlaps and stores overlaps' vertices and all edges' overlaps
110 *
111 * Requires \ref SCIPhypergraphHasVertexEdges to be \c TRUE which results from
112 * \ref SCIPhypergraphComputeVerticesEdges.
113 */
115 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph. */
116 SCIP_DECL_HYPERGRAPH_OVERLAP((*handler)), /**< Function to be called once the overlap is found. */
117 void* userdata /**< Pointer passed to \p handler. */
118 );
119
120/**
121 * @brief finds the overlap corresponding to vertex set \p vertices; returns -1 if it is not found
122 *
123 * Requires \ref SCIPhypergraphHasOverlaps to be \c TRUE which results from \ref SCIPhypergraphComputeOverlaps.
124 */
126 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph. */
127 int nvertices, /**< Number of vertices. */
128 SCIP_HYPERGRAPH_VERTEX* vertices, /**< Sorted array of vertices. */
129 SCIP_HYPERGRAPH_OVERLAP* poverlap /**< Pointer for storing the overlap. */
130 );
131
132/**
133 * @brief finds the overlap or singleton vertex corresponding to the intersection of edges \p first and \p second
134 *
135 * Requires \ref SCIPhypergraphHasOverlaps to be \c TRUE which results from \ref SCIPhypergraphComputeOverlaps.
136 */
138 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph. */
139 SCIP_HYPERGRAPH_EDGE first, /**< First edge to intersect. */
140 SCIP_HYPERGRAPH_EDGE second, /**< Second edge to intersect. */
141 SCIP_HYPERGRAPH_OVERLAP* poverlap, /**< Pointer for storing the overlap. */
142 SCIP_HYPERGRAPH_VERTEX* pvertex /**< Pointer for storing the vertex. */
143 );
144
145/**
146 * @brief computes all overlaps' lists of incident edges
147 *
148 * Requires \ref SCIPhypergraphHasOverlaps to be \c TRUE which results from \ref SCIPhypergraphComputeOverlaps.
149 */
151 SCIP_HYPERGRAPH* hypergraph /**< The hypergraph. */
152 );
153
154/**
155 * @brief computes all vertices' lists of incident overlaps
156 *
157 * Requires \ref SCIPhypergraphHasOverlaps.
158 */
160 SCIP_HYPERGRAPH* hypergraph /**< The hypergraph. */
161 );
162
163/** @brief returns whether overlaps \p overlap1 and \p overlap2 are disjoint */
165 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph. */
166 SCIP_HYPERGRAPH_OVERLAP overlap1, /**< First overlap. */
167 SCIP_HYPERGRAPH_OVERLAP overlap2 /**< Second overlap. */
168 );
169
170/** @brief asserts that the hypergraph data structures are valid */
172 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph. */
173 FILE* file /**< A file stream to print problems to (can be \c NULL). */
174 );
175
176/** @brief initializes a hypergraph iterator's internal memory */
178 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph of this iterator. */
179 SCIP_HYPERGRAPH_ITER* iterator /**< Iterator to be initialized. */
180 );
181
182/** @brief frees a hypergraph iterator's internal memory */
184 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph of this iterator. */
185 SCIP_HYPERGRAPH_ITER* iterator /**< Iterator to be cleared. */
186 );
187
188/**
189 * @brief initializes the iterator to the first adjacent edge of \p base
190 *
191 * \p findoverlaps indicates whether the overlap corresponding to each edge intersection shall be determined. This
192 * requires \ref SCIPhypergraphHasOverlaps.
193 */
195 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph of this iterator. */
196 SCIP_HYPERGRAPH_ITER* iterator, /**< Iterator to be initialized. */
197 SCIP_HYPERGRAPH_EDGE base, /**< Base edge. */
198 unsigned int minoverlapsize, /**< Minimum size of the overlap. */
199 SCIP_Bool onlylater, /**< Whether to only consider edges greater than \p base. */
200 SCIP_Bool findoverlaps /**< Whether to compute the overlap sets. */
201 );
202
203/** @brief returns whether the iterator is valid */
205 SCIP_HYPERGRAPH_ITER* iterator /**< Iterator. */
206 );
207
208/** @brief initializes the iterator to the first adjacent edge of \p base */
210 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph of this iterator. */
211 SCIP_HYPERGRAPH_ITER* iterator /**< Iterator. */
212 );
213
214/** @brief returns the base edge */
216 SCIP_HYPERGRAPH_ITER* iterator /**< Iterator. */
217 );
218
219/** @brief returns the current adjacent edge */
221 SCIP_HYPERGRAPH_ITER* iterator /**< Iterator. */
222 );
223
224/** @brief returns the minimum vertex in the intersection of the base and the current adjacent edge */
226 SCIP_HYPERGRAPH_ITER* iterator /**< Iterator. */
227 );
228
229/**
230 * @brief returns the overlap for the intersection of the base and the current adjacent edge
231 *
232 * If the intersection of the two edges has only one element, then -1 is returned, and if overlap information was not
233 * requested in \ref SCIPhypergraphIterStart, then -2 is returned.
234 */
236 SCIP_HYPERGRAPH_ITER* iterator /**< Iterator. */
237 );
238
239/**
240 * @brief returns whether vertices' incident edges are known.
241 *
242 * Use \ref SCIPhypergraphComputeVerticesEdges to compute them.
243 */
244
246 SCIP_HYPERGRAPH* hypergraph /**< The hypergraph. */
247 );
248
249/**
250 * @brief returns whether edges' overlaps and overlaps' vertices are known.
251 *
252 * Use \ref SCIPhypergraphComputeOverlaps to compute them.
253 */
255 SCIP_HYPERGRAPH* hypergraph /**< The hypergraph. */
256 );
257
258/**
259 * @brief returns whether overlaps' incident edges are known.
260 *
261 * Use \ref SCIPhypergraphComputeOverlapsEdges to compute them.
262 */
264 SCIP_HYPERGRAPH* hypergraph /**< The hypergraph. */
265 );
266
267/**
268 * @brief returns whether vertices' incident overlaps are known
269 *
270 * Use \ref SCIPhypergraphComputeOverlaps to compute them.
271 */
273 SCIP_HYPERGRAPH* hypergraph /**< The hypergraph. */
274 );
275
276/** @brief returns the number of vertices */
278 SCIP_HYPERGRAPH* hypergraph /**< The hypergraph. */
279 );
280
281/** @brief returns the number of edges */
283 SCIP_HYPERGRAPH* hypergraph /**< The hypergraph. */
284 );
285
286/** @brief returns the hypergraph's block memory structure */
288 SCIP_HYPERGRAPH* hypergraph /**< The hypergraph. */
289 );
290
291/** @brief returns the number of overlaps */
293 SCIP_HYPERGRAPH* hypergraph /**< The hypergraph. */
294 );
295
296/** @brief returns the number of vertex-edge incidences. */
298 SCIP_HYPERGRAPH* hypergraph /**< The hypergraph. */
299 );
300
301/** @brief returns additional data of \p vertex */
303 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph. */
304 SCIP_HYPERGRAPH_VERTEX vertex /**< A vertex. */
305 );
306
307/** @brief returns additional data of \p edge */
309 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph. */
310 SCIP_HYPERGRAPH_EDGE edge /**< Edge. */
311 );
312
313/** @brief returns the number of vertices of \p edge */
315 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph. */
316 SCIP_HYPERGRAPH_EDGE edge /**< Edge. */
317 );
318
319/**
320 * @brief returns the array of vertices of \p edge
321 *
322 * The length of the array is \ref SCIPhypergraphEdgeSize.
323 */
324
326 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph. */
327 SCIP_HYPERGRAPH_EDGE edge /**< Edge. */
328 );
329
330/** @brief returns an index for the first edge incident to \p vertex */
332 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph. */
333 SCIP_HYPERGRAPH_VERTEX vertex /**< A vertex. */
334 );
335
336/** @brief returns an index beyond the last edge incident to \p vertex */
338 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph. */
339 SCIP_HYPERGRAPH_VERTEX vertex /**< A vertex. */
340 );
341
342/**
343 * @brief returns the edge corresponding to \p index that is incident to a vertex
344 *
345 * See \ref SCIPhypergraphVertexEdgesFirst and \ref SCIPhypergraphVertexEdgesBeyond to obtain such indices for a vertex.
346 */
348 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph. */
349 int idx /**< Index. */
350 );
351
352/** @brief returns additional data of \p overlap */
354 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph. */
355 SCIP_HYPERGRAPH_OVERLAP overlap /**< Overlap. */
356 );
357
358/**
359 * @brief returns the number of vertices of \p overlap
360 *
361 * Requires \ref SCIPhypergraphHasOverlaps to be \c TRUE which results from \ref SCIPhypergraphComputeOverlaps.
362 */
364 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph. */
365 SCIP_HYPERGRAPH_OVERLAP overlap /**< Overlap. */
366 );
367
368/**
369 * @brief returns the array of sorted vertices of \p overlap
370 *
371 * The length of the array is \ref SCIPhypergraphOverlapSize.
372 * Requires \ref SCIPhypergraphHasOverlaps to be \c TRUE which results from \ref SCIPhypergraphComputeOverlaps.
373 */
375 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph. */
376 SCIP_HYPERGRAPH_OVERLAP overlap /**< Overlap. */
377 );
378
379/** @brief returns an index for the first overlap incident to \p edge */
381 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph. */
382 SCIP_HYPERGRAPH_EDGE edge /**< Edge. */
383 );
384
385/** @brief returns an index beyond the last overlap incident to \p edge */
387 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph. */
388 SCIP_HYPERGRAPH_EDGE edge /**< Edge. */
389 );
390
391/**
392 * @brief returns the overlap corresponding to \p index that is incident to an edge
393 *
394 * See \ref SCIPhypergraphEdgesOverlapsFirst and \ref SCIPhypergraphEdgesOverlapsBeyond to obtain such indices for an
395 * edge.
396 */
398 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph. */
399 int idx /**< Index. */
400 );
401
402/** @brief returns an index for the first edge incident to \p overlap */
404 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph. */
405 SCIP_HYPERGRAPH_OVERLAP overlap /**< Overlap. */
406 );
407
408/** @brief returns an index beyond the last edge incident to \p overlap */
410 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph. */
411 SCIP_HYPERGRAPH_OVERLAP overlap /**< Overlap. */
412 );
413
414/**
415 * @brief returns the edge corresponding to \p index that is incident to an overlap
416 *
417 * See \ref SCIPhypergraphOverlapsEdgesFirst and \ref SCIPhypergraphOverlapsEdgesBeyond to obtain such indices for an
418 * overlap.
419 */
421 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph. */
422 int idx /**< Index. */
423 );
424
425/** @brief returns an index for the first overlap containing \p vertex */
427 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph. */
428 SCIP_HYPERGRAPH_VERTEX vertex /**< A vertex. */
429 );
430
431/** @brief returns an index beyond the last overlap incident to \p vertex */
433 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph. */
434 SCIP_HYPERGRAPH_VERTEX vertex /**< A vertex. */
435 );
436
437/**
438 * @brief returns the overlap corresponding to \p index that is incident to a vertex
439 *
440 * See \ref SCIPhypergraphVertexOverlapsFirst and \ref SCIPhypergraphVertexOverlapsBeyond to obtain such indices for a
441 * vertex.
442 */
444 SCIP_HYPERGRAPH* hypergraph, /**< The hypergraph. */
445 int idx /**< Index. */
446 );
447
448
449#ifdef NDEBUG
450
451/* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and speed up
452 * the algorithms.
453 */
454
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])
489
490#endif /* NDEBUG */
491
492#ifdef __cplusplus
493}
494#endif
495
496#endif
#define SCIP_Bool
Definition: def.h:91
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
Definition: hypergraph.c:1506
int SCIPhypergraphEdgesOverlapsBeyond(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_EDGE edge)
returns an index beyond the last overlap incident to edge
Definition: hypergraph.c:1995
void SCIPhypergraphIterNext(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_ITER *iterator)
initializes the iterator to the first adjacent edge of base
Definition: hypergraph.c:1547
SCIP_RETCODE SCIPhypergraphFree(SCIP_HYPERGRAPH **phypergraph)
frees a hypergraph
Definition: hypergraph.c:281
SCIP_HYPERGRAPH_EDGE SCIPhypergraphIterAdjacent(SCIP_HYPERGRAPH_ITER *iterator)
returns the current adjacent edge
Definition: hypergraph.c:1693
SCIP_HYPERGRAPH_EDGE SCIPhypergraphIterBase(SCIP_HYPERGRAPH_ITER *iterator)
returns the base edge
Definition: hypergraph.c:1685
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
Definition: hypergraph.c:416
SCIP_HYPERGRAPH_OVERLAP SCIPhypergraphIterOverlap(SCIP_HYPERGRAPH_ITER *iterator)
returns the overlap for the intersection of the base and the current adjacent edge
Definition: hypergraph.c:1714
int SCIPhypergraphOverlapsEdgesBeyond(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_OVERLAP overlap)
returns an index beyond the last edge incident to overlap
Definition: hypergraph.c:2051
void SCIPhypergraphIterClear(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_ITER *iterator)
frees a hypergraph iterator's internal memory
Definition: hypergraph.c:1494
SCIP_HYPERGRAPH_EDGE SCIPhypergraphVertexEdgesGetAtIndex(SCIP_HYPERGRAPH *hypergraph, int idx)
returns the edge corresponding to index that is incident to a vertex
Definition: hypergraph.c:1921
int SCIPhypergraphVertexEdgesBeyond(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_VERTEX vertex)
returns an index beyond the last edge incident to vertex
Definition: hypergraph.c:1905
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
Definition: hypergraph.c:929
SCIP_Bool SCIPhypergraphIterValid(SCIP_HYPERGRAPH_ITER *iterator)
returns whether the iterator is valid
Definition: hypergraph.c:1537
int SCIPhypergraphGetNEdges(SCIP_HYPERGRAPH *hypergraph)
returns the number of edges
Definition: hypergraph.c:1774
int SCIPhypergraphVertexOverlapsBeyond(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_VERTEX vertex)
returns an index beyond the last overlap incident to vertex
Definition: hypergraph.c:2107
SCIP_RETCODE SCIPhypergraphComputeVerticesEdges(SCIP_HYPERGRAPH *hypergraph)
computes each vertex' list of incident edges
Definition: hypergraph.c:811
SCIP_HYPERGRAPH_OVERLAPDATA * SCIPhypergraphOverlapData(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_OVERLAP overlap)
returns additional data of overlap
Definition: hypergraph.c:1838
SCIP_RETCODE SCIPhypergraphAddVertex(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_VERTEX *pvertex, SCIP_HYPERGRAPH_VERTEXDATA **pvertexdata)
adds a new vertex to the hypergraph
Definition: hypergraph.c:386
int SCIPhypergraphEdgeSize(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_EDGE edge)
returns the number of vertices of edge
Definition: hypergraph.c:1850
SCIP_Bool SCIPhypergraphHasOverlapsEdges(SCIP_HYPERGRAPH *hypergraph)
returns whether overlaps' incident edges are known.
Definition: hypergraph.c:2029
SCIP_Bool SCIPhypergraphOverlapsDisjoint(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_OVERLAP overlap1, SCIP_HYPERGRAPH_OVERLAP overlap2)
returns whether overlaps overlap1 and overlap2 are disjoint
Definition: hypergraph.c:1187
SCIP_Bool SCIPhypergraphIsValid(SCIP_HYPERGRAPH *hypergraph, FILE *file)
asserts that the hypergraph data structures are valid
Definition: hypergraph.c:1221
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
Definition: hypergraph.c:906
SCIP_RETCODE SCIPhypergraphClear(SCIP_HYPERGRAPH *hypergraph)
clears a hypergraph, deleting all vertices and edges
Definition: hypergraph.c:361
SCIP_Bool SCIPhypergraphHasOverlaps(SCIP_HYPERGRAPH *hypergraph)
returns whether edges' overlaps and overlaps' vertices are known.
Definition: hypergraph.c:1937
SCIP_Bool SCIPhypergraphHasVertexOverlaps(SCIP_HYPERGRAPH *hypergraph)
returns whether vertices' incident overlaps are known
Definition: hypergraph.c:2085
SCIP_HYPERGRAPH_VERTEX * SCIPhypergraphEdgeVertices(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_EDGE edge)
returns the array of vertices of edge
Definition: hypergraph.c:1867
int SCIPhypergraphEdgesOverlapsFirst(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_EDGE edge)
returns an index for the first overlap incident to edge
Definition: hypergraph.c:1982
int SCIPhypergraphOverlapsEdgesFirst(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_OVERLAP overlap)
returns an index for the first edge incident to overlap
Definition: hypergraph.c:2039
SCIP_HYPERGRAPH_VERTEX SCIPhypergraphIterMinVertex(SCIP_HYPERGRAPH_ITER *iterator)
returns the minimum vertex in the intersection of the base and the current adjacent edge
Definition: hypergraph.c:1701
SCIP_HYPERGRAPH_VERTEXDATA * SCIPhypergraphVertexData(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_VERTEX vertex)
returns additional data of vertex
Definition: hypergraph.c:1814
SCIP_HYPERGRAPH_OVERLAP SCIPhypergraphVertexOverlapsGetAtIndex(SCIP_HYPERGRAPH *hypergraph, int idx)
returns the overlap corresponding to index that is incident to a vertex
Definition: hypergraph.c:2124
int SCIPhypergraphVertexOverlapsFirst(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_VERTEX vertex)
returns an index for the first overlap containing vertex
Definition: hypergraph.c:2095
SCIP_RETCODE SCIPhypergraphComputeOverlapsEdges(SCIP_HYPERGRAPH *hypergraph)
computes all overlaps' lists of incident edges
Definition: hypergraph.c:990
SCIP_HYPERGRAPH_OVERLAP SCIPhypergraphOverlapsEdgesGetAtIndex(SCIP_HYPERGRAPH *hypergraph, int idx)
returns the edge corresponding to index that is incident to an overlap
Definition: hypergraph.c:2068
SCIP_RETCODE SCIPhypergraphComputeOverlaps(SCIP_HYPERGRAPH *hypergraph, SCIP_DECL_HYPERGRAPH_OVERLAP((*handler)), void *userdata)
computes all overlaps and stores overlaps' vertices and all edges' overlaps
Definition: hypergraph.c:587
SCIP_RETCODE SCIPhypergraphComputeVerticesOverlaps(SCIP_HYPERGRAPH *hypergraph)
computes all vertices' lists of incident overlaps
Definition: hypergraph.c:1091
int SCIPhypergraphGetNIncidences(SCIP_HYPERGRAPH *hypergraph)
returns the number of vertex-edge incidences.
Definition: hypergraph.c:1804
SCIP_Bool SCIPhypergraphHasVertexEdges(SCIP_HYPERGRAPH *hypergraph)
returns whether vertices' incident edges are known.
Definition: hypergraph.c:1883
int SCIPhypergraphGetNVertices(SCIP_HYPERGRAPH *hypergraph)
returns the number of vertices
Definition: hypergraph.c:1764
SCIP_HYPERGRAPH_OVERLAP SCIPhypergraphEdgesOverlapsGetAtIndex(SCIP_HYPERGRAPH *hypergraph, int idx)
returns the overlap corresponding to index that is incident to an edge
Definition: hypergraph.c:2013
SCIP_RETCODE SCIPhypergraphIterInit(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_ITER *iterator)
initializes a hypergraph iterator's internal memory
Definition: hypergraph.c:1469
int SCIPhypergraphVertexEdgesFirst(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_VERTEX vertex)
returns an index for the first edge incident to vertex
Definition: hypergraph.c:1893
SCIP_HYPERGRAPH_VERTEX * SCIPhypergraphOverlapVertices(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_OVERLAP overlap)
returns the array of sorted vertices of overlap
Definition: hypergraph.c:1969
int SCIPhypergraphOverlapSize(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_OVERLAP overlap)
returns the number of vertices of overlap
Definition: hypergraph.c:1951
int SCIPhypergraphGetNOverlaps(SCIP_HYPERGRAPH *hypergraph)
returns the number of overlaps
Definition: hypergraph.c:1794
SCIP_HYPERGRAPH_EDGEDATA * SCIPhypergraphEdgeData(SCIP_HYPERGRAPH *hypergraph, SCIP_HYPERGRAPH_EDGE edge)
returns additional data of edge
Definition: hypergraph.c:1826
BMS_BLKMEM * SCIPhypergraphBlkmem(SCIP_HYPERGRAPH *hypergraph)
returns the hypergraph's block memory structure
Definition: hypergraph.c:1784
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
Definition: hypergraph.c:210
memory allocation routines
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:437
datastructures hypergraphs
type definitions for hypergraphs
int SCIP_HYPERGRAPH_EDGE
int SCIP_HYPERGRAPH_OVERLAP
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
Definition: type_retcode.h:63