CMR  1.3.0
Loading...
Searching...
No Matches
seymour_internal.h
Go to the documentation of this file.
1#ifndef CMR_SEYMOUR_INTERNAL_H
2#define CMR_SEYMOUR_INTERNAL_H
3
4#include <time.h>
5
6#include "densematrix.h"
7
8#include <cmr/matroid.h>
9#include <cmr/seymour.h>
10#include <cmr/series_parallel.h>
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16
18{
19 size_t used;
21 bool isTernary;
23 int8_t regularity;
25 int8_t graphicness;
29 bool testedR10;
34 size_t numChildren;
45 size_t numRows;
46 size_t* rowsToChild;
49 size_t numColumns;
53 size_t memMinors;
54 size_t numMinors;
71 size_t* pivotRows;
72 size_t* pivotColumns;
73 size_t numPivots;
97};
98
108
109
122 bool recurse
123);
124
129CMR_EXPORT
131 CMR* cmr,
132 CMR_SEYMOUR_NODE* child,
133 CMR_SEYMOUR_NODE* parent,
134 size_t childIndex,
135 FILE* stream,
136 size_t indent,
137 bool printChildren,
138 bool printParentElements,
139 bool printMatrices,
140 bool printGraphs,
141 bool printReductions,
142 bool printPivots
143);
144
152 CMR* cmr,
154 CMR_MINOR* minor
155);
156
162 CMR* cmr,
164 size_t numChildren
165);
166
172 CMR* cmr,
174 size_t numChildren
175);
176
184 CMR* cmr,
185 CMR_SEYMOUR_NODE* parent,
186 size_t childIndex,
187 CMR_CHRMAT* matrix,
188 CMR_CHRMAT* transpose,
189 CMR_ELEMENT* rowsToParent,
190 CMR_ELEMENT* columnsToParent
191);
192
200 CMR* cmr,
202 CMR_SUBMAT* violator
203);
204
209 CMR* cmr,
211 CMR_SUBMAT* reducedSubmatrix
212);
213
221 CMR* cmr,
223 CMR_SEPA* separation
224);
225
233 CMR* cmr,
235 size_t numPivots,
236 size_t* pivotRows,
237 size_t* pivotColumns,
238 CMR_CHRMAT* matrix,
239 CMR_CHRMAT* transpose
240);
241
248);
249
250
256 CMR* cmr,
257 CMR_SEYMOUR_NODE* dec,
258 DecompositionTask** ptask,
261 clock_t startClock,
262 double timeLimit
263);
264
270 CMR* cmr,
271 DecompositionTask** ptask
272);
273
281
287 CMR* cmr,
288 DecompositionQueue** pqueue
289);
290
296 CMR* cmr,
297 DecompositionQueue** pqueue
298);
299
305 DecompositionQueue* queue
306);
307
313 DecompositionQueue* queue
314);
315
316
322 DecompositionQueue* queue,
323 DecompositionTask* task
324);
325
332 CMR* cmr,
333 DecompositionTask* task,
334 DecompositionQueue* queue,
335 CMR_SEPA* separation
336);
337
344 CMR* cmr,
345 DecompositionTask* task,
346 DecompositionQueue* queue
347);
348
357 CMR* cmr,
358 DecompositionTask* task,
359 DecompositionQueue* queue
360);
361
370 CMR* cmr,
371 DecompositionTask* task,
372 DecompositionQueue* queue
373);
374
384 CMR* cmr,
385 DecompositionTask* task,
386 DecompositionQueue* queue
387);
388
394 CMR* cmr,
395 DecompositionTask* task,
396 DecompositionQueue* queue
397);
398
404 CMR* cmr,
405 DecompositionTask* task,
406 CMR_SUBMAT* wheelSubmatrix
407);
408
420 CMR* cmr,
421 DecompositionTask* task,
422 DecompositionQueue* queue
423);
424
430 CMR* cmr,
431 DecompositionTask* task,
432 DecompositionQueue* queue
433);
434
440 CMR* cmr,
441 DecompositionTask* task,
442 DecompositionQueue* queue
443);
444
454 CMR* cmr,
455 DecompositionTask* task,
456 DecompositionQueue* queue
457);
458
469 CMR* cmr,
470 CMR_CHRMAT* matrix,
471 bool ternary,
472 CMR_SEYMOUR_NODE** proot,
473 CMR_SEYMOUR_PARAMS* params,
474 CMR_SEYMOUR_STATS* stats,
475 double timeLimit
476);
477
483 CMR* cmr,
484 CMR_SEYMOUR_NODE* subtree,
485 CMR_SEYMOUR_PARAMS* params,
486 CMR_SEYMOUR_STATS* stats,
487 double timeLimit
488);
489
495 CMR* cmr,
496 size_t numNodes,
497 CMR_SEYMOUR_NODE** nodes,
498 CMR_SEYMOUR_PARAMS* params,
499 CMR_SEYMOUR_STATS* stats,
500 double timeLimit
501);
502
503#ifdef __cplusplus
504}
505#endif
506
507#endif /* CMR_SEYMOUR_INTERNAL_H */
int CMR_ELEMENT
Definition element.h:20
CMR_ERROR
Type for return codes of library functions.
Definition env.h:32
int CMR_GRAPH_EDGE
Reference to an edge of CMR_GRAPH.
Definition graph.h:31
CMR_SEYMOUR_DECOMPOSE_FLAG
Flags that indicate how to decompose as a -sum.
Definition seymour.h:40
CMR_SEYMOUR_NODE_TYPE
Definition seymour.h:176
Functionality for matroids.
Recognition of series-parallel matrices.
Functionality for Seymour decomposition.
CMR_ERROR CMRregularityNestedMinorSequenceSearchThreeSeparation(CMR *cmr, DecompositionTask *task, DecompositionQueue *queue)
Searches for 3-separations along the sequence of nested minors and decomposes as a 3-sum.
Definition regularity_partition.c:733
CMR_ERROR CMRregularityTestGraphicness(CMR *cmr, DecompositionTask *task, DecompositionQueue *queue)
Tests matrix for graphicness/network and stores it in dec.
Definition regularity_graphic.c:1792
CMR_ERROR CMRregularityTestR10(CMR *cmr, DecompositionTask *task, DecompositionQueue *queue)
Tests matrix for representing .
Definition regularity_r10.c:8
CMR_ERROR CMRseymourAddMinor(CMR *cmr, CMR_SEYMOUR_NODE *node, CMR_MINOR *minor)
Adds a minor to a Seymour decomposition node.
Definition seymour.c:966
CMR_ERROR CMRregularityDecomposeThreeSum(CMR *cmr, DecompositionTask *task, DecompositionQueue *queue, CMR_SEPA *separation)
Applies a 3-sum decomposition.
Definition regularity_threesum.c:27
CMR_ERROR CMRregularityInitNestedMinorSequence(CMR *cmr, DecompositionTask *task, CMR_SUBMAT *wheelSubmatrix)
Initializes a sequence of nested minors with one minor, for a given wheelSubmatrix.
Definition regularity_nested_minor_sequence.c:1052
CMR_ERROR CMRregularityRefineDecomposition(CMR *cmr, size_t numNodes, CMR_SEYMOUR_NODE **nodes, CMR_SEYMOUR_PARAMS *params, CMR_SEYMOUR_STATS *stats, double timeLimit)
Replaces the subtrees of several nodes of a matroid decomposition tree by new ones.
Definition seymour.c:1846
CMR_ERROR CMRseymourCreateChildFromMatrices(CMR *cmr, CMR_SEYMOUR_NODE *parent, size_t childIndex, CMR_CHRMAT *matrix, CMR_CHRMAT *transpose, CMR_ELEMENT *rowsToParent, CMR_ELEMENT *columnsToParent)
Creates a decomposition node as a child.
Definition seymour.c:1023
void CMRregularityQueueAdd(DecompositionQueue *queue, DecompositionTask *task)
Adds a task to a decomposition queue.
Definition seymour.c:1623
CMR_ERROR CMRregularitySearchOnesum(CMR *cmr, DecompositionTask *task, DecompositionQueue *queue)
Performs a 1-sum decomposition of matrix and stores it in dec.
Definition regularity_onesum.c:20
CMR_ERROR CMRseymourUpdateViolator(CMR *cmr, CMR_SEYMOUR_NODE *node, CMR_SUBMAT *violator)
Initialize an existing unknown decomposition node to be irregular with a violator submatrix.
Definition seymour.c:1108
CMR_ERROR CMRseymourUpdateTwosum(CMR *cmr, CMR_SEYMOUR_NODE *node, CMR_SEPA *separation)
Initialize an existing unknown decomposition node as a 2-separation node according to the given separ...
Definition seymour.c:1147
CMR_ERROR CMRseymourSetNumChildren(CMR *cmr, CMR_SEYMOUR_NODE *node, size_t numChildren)
Sets the number of children and allocates memory accordingly.
Definition seymour.c:998
CMR_ERROR CMRseymourUpdateSeriesParallel(CMR *cmr, CMR_SEYMOUR_NODE *node, CMR_SUBMAT *reducedSubmatrix)
Updates an existing unknown Seymour decomposition node to be a series-parallel node.
Definition seymour.c:1125
char * CMRseymourConsistency(CMR_SEYMOUR_NODE *node, bool recurse)
Checks a Seymour decomposition node for consistency.
DecompositionTask * CMRregularityQueueRemove(DecompositionQueue *queue)
Removes a task from a decomposition queue.
Definition seymour.c:1613
CMR_ERROR CMRregularityTaskCreateRoot(CMR *cmr, CMR_SEYMOUR_NODE *dec, DecompositionTask **ptask, CMR_SEYMOUR_PARAMS *params, CMR_SEYMOUR_STATS *stats, clock_t startClock, double timeLimit)
Creates a decomposition task for the root of the decomposition.
Definition seymour.c:1535
CMR_ERROR CMRseymourDecompose(CMR *cmr, CMR_CHRMAT *matrix, bool ternary, CMR_SEYMOUR_NODE **proot, CMR_SEYMOUR_PARAMS *params, CMR_SEYMOUR_STATS *stats, double timeLimit)
Tests ternary or binary linear matroid for regularity.
Definition seymour.c:1719
CMR_ERROR CMRregularityQueueCreate(CMR *cmr, DecompositionQueue **pqueue)
Initializes a decomposition queue.
Definition seymour.c:1570
CMR_ERROR CMRregularityExtendNestedMinorSequence(CMR *cmr, DecompositionTask *task, DecompositionQueue *queue)
Extends an incomplete sequence of nested 3-connected minors for the matrix of a decomposition node.
Definition regularity_nested_minor_sequence.c:627
CMR_ERROR CMRregularityQueueFree(CMR *cmr, DecompositionQueue **pqueue)
Frees the decomposition queue.
Definition seymour.c:1585
CMR_ERROR CMRregularityNestedMinorSequenceGraphicness(CMR *cmr, DecompositionTask *task, DecompositionQueue *queue)
Tests each minor of the sequence of nested 3-connected minors for graphicness.
Definition regularity_graphic.c:1623
CMR_ERROR CMRseymourSetAttributes(CMR_SEYMOUR_NODE *node)
Set regularity and (co)graphicness attributes of a decomposition tree.
Definition seymour.c:1272
CMR_ERROR CMRseymourUpdatePivots(CMR *cmr, CMR_SEYMOUR_NODE *node, size_t numPivots, size_t *pivotRows, size_t *pivotColumns, CMR_CHRMAT *matrix, CMR_CHRMAT *transpose)
Initialize an existing unknown decomposition node as a pivot node according to the given arrays of pi...
Definition seymour.c:1230
CMR_ERROR CMRregularityNestedMinorSequenceCographicness(CMR *cmr, DecompositionTask *task, DecompositionQueue *queue)
Tests each minor of the sequence of nested 3-connected minors for graphicness.
Definition regularity_graphic.c:1710
CMR_ERROR CMRregularityTestCographicness(CMR *cmr, DecompositionTask *task, DecompositionQueue *queue)
Tests matrix for cographicness/conetwork and stores it in dec.
Definition regularity_graphic.c:1877
CMR_ERROR CMRregularityCompleteDecomposition(CMR *cmr, CMR_SEYMOUR_NODE *subtree, CMR_SEYMOUR_PARAMS *params, CMR_SEYMOUR_STATS *stats, double timeLimit)
Replaces the subtree of a matroid decomposition tree by a new one.
Definition seymour.c:1748
bool CMRregularityQueueEmpty(DecompositionQueue *queue)
Returns whether a queue is empty.
Definition seymour.c:1606
CMR_ERROR CMRregularityTaskFree(CMR *cmr, DecompositionTask **ptask)
Frees a decomposition task.
Definition seymour.c:1557
CMR_ERROR CMRseymourUpdateOnesum(CMR *cmr, CMR_SEYMOUR_NODE *node, size_t numChildren)
Initialize an existing unknown decomposition node as a 1-sum with numChildren children.
Definition seymour.c:1066
CMR_EXPORT CMR_ERROR CMRseymourPrintChild(CMR *cmr, CMR_SEYMOUR_NODE *child, CMR_SEYMOUR_NODE *parent, size_t childIndex, FILE *stream, size_t indent, bool printChildren, bool printParentElements, bool printMatrices, bool printGraphs, bool printReductions, bool printPivots)
Prints the decomposition child to stream.
Definition seymour.c:347
CMR_ERROR CMRregularityDecomposeSeriesParallel(CMR *cmr, DecompositionTask *task, DecompositionQueue *queue)
Splits off series-parallel elements from the matrix of the decomposition node.
Definition regularity_series_parallel.c:10
Row-wise representation of sparse char matrix.
Definition matrix.h:235
Definition env_internal.h:45
Definition graph.h:49
A minor of a matroid.
Definition matroid.h:157
Definition separation.h:52
Parameters for Seymour decomposition algorithm.
Definition seymour.h:68
Statistics for Seymour decomposition algorithm.
Definition seymour.h:133
Represents a series-parallel reduction.
Definition series_parallel.h:61
Row and column indices for a submatrix.
Definition matrix.h:28
Definition seymour_internal.h:275
bool foundNongraphicness
Whether non-graphiness was detected for some node.
Definition seymour_internal.h:278
DecompositionTask * head
Next task to be processed.
Definition seymour_internal.h:276
bool foundIrregularity
Whether irregularity was detected for some node.
Definition seymour_internal.h:277
bool foundNoncographicness
Whether non-cographiness was detected for some node.
Definition seymour_internal.h:279
Definition seymour_internal.h:100
struct DecompositionTask * next
Next task in queue.
Definition seymour_internal.h:102
CMR_SEYMOUR_STATS * stats
Statistics for the computation (may be NULL).
Definition seymour_internal.h:104
clock_t startClock
Clock for the start time.
Definition seymour_internal.h:105
CMR_SEYMOUR_NODE * node
Decomposition node that shall be processed.
Definition seymour_internal.h:101
CMR_SEYMOUR_PARAMS * params
Parameters for the computation.
Definition seymour_internal.h:103
double timeLimit
Time limit to impose.
Definition seymour_internal.h:106
Dense matrix.
Definition densematrix.h:17
Definition seymour_internal.h:18
CMR_GRAPH * graph
Graph represented by this matrix.
Definition seymour_internal.h:57
int8_t regularity
Matrix is (not) regular/totally unimodularity if positive (negative), or not determined if zero.
Definition seymour_internal.h:23
CMR_GRAPH * cograph
Graph represented by the transpose of this matrix.
Definition seymour_internal.h:62
CMR_ELEMENT * nestedMinorsColumnsOriginal
Maps columns of nestedMinorsDense to elements of matrix.
Definition seymour_internal.h:92
size_t memMinors
Memory allocated for minors/submatrices.
Definition seymour_internal.h:53
bool * cographArcsReversed
Array indicating which arcs of the cograph are reversed.
Definition seymour_internal.h:65
CMR_CHRMAT * transpose
Tranpose of matrix representing this node.
Definition seymour_internal.h:33
bool testedTwoConnected
Indicates that no 1-separation exists.
Definition seymour_internal.h:22
size_t ** childSpecialColumns
Array for mapping a child index to array of special child columns relevant for 2- and 3-sums.
Definition seymour_internal.h:42
size_t numPivots
Number of pivots.
Definition seymour_internal.h:73
CMR_CHRMAT * nestedMinorsTranspose
Transpose of nestedMinorsMatrix.
Definition seymour_internal.h:89
size_t numMinors
Number of minors/submatrices.
Definition seymour_internal.h:54
size_t * columnsToChild
Array for mapping each column to a column of the child (if applicable).
Definition seymour_internal.h:50
size_t numChildren
Number of child nodes.
Definition seymour_internal.h:34
size_t nestedMinorsLength
Length of sequence of nested minors.
Definition seymour_internal.h:83
int8_t cographicness
Matrix is (not) cographic/conetwork if positive (negative), or not determined if zero.
Definition seymour_internal.h:27
CMR_ELEMENT * denseColumnsOriginal
Maps columns of denseMatrix to elements of matrix.
Definition seymour_internal.h:78
bool * graphArcsReversed
Array indicating which arcs of the graph are reversed.
Definition seymour_internal.h:60
size_t * nestedMinorsSequenceNumColumns
Number of columns of sequence of nested minors.
Definition seymour_internal.h:85
bool testedR10
Matrix does not represent unless type indicates this.
Definition seymour_internal.h:29
CMR_GRAPH_EDGE * cographForest
Array with edges of spanning forest of cograph.
Definition seymour_internal.h:63
CMR_ELEMENT * denseRowsOriginal
Maps rows of denseMatrix to elements of matrix.
Definition seymour_internal.h:77
CMR_MINOR ** minors
Array of minors/submatrices containing more information.
Definition seymour_internal.h:55
size_t * nestedMinorsSequenceNumRows
Number of rows of sequence of nested minors.
Definition seymour_internal.h:84
struct _CMR_SEYMOUR_NODE ** children
Array of child nodes.
Definition seymour_internal.h:35
CMR_GRAPH_EDGE * graphForest
Array with edges of spanning forest of graph.
Definition seymour_internal.h:58
CMR_SEYMOUR_DECOMPOSE_FLAG threesumFlags
Type of 3-sum.
Definition seymour_internal.h:31
int8_t graphicness
Matrix is (not) graphic/network if positive (negative), or not determined if zero.
Definition seymour_internal.h:25
size_t * pivotRows
Rows of pivots.
Definition seymour_internal.h:71
bool testedSeriesParallel
Already searched for series-parallel reductions.
Definition seymour_internal.h:67
size_t numColumns
Length of columnsToChild.
Definition seymour_internal.h:49
size_t * nestedMinorsRowsDense
Maps rows of nested minor sequence to rows of dense.
Definition seymour_internal.h:79
size_t nestedMinorsLastGraphic
Last minor in sequence of nested minors that is graphic.
Definition seymour_internal.h:95
size_t nestedMinorsLastCographic
Last minor in sequence of nested minors that is cographic.
Definition seymour_internal.h:96
CMR_CHRMAT * nestedMinorsMatrix
Sparse support matrix that displays the sequence of nested minors. Rows and columns are permuted acco...
Definition seymour_internal.h:87
CMR_ELEMENT ** childRowsToParent
Array for mapping a child index to array of child rows to elements of this node.
Definition seymour_internal.h:36
CMR_SEYMOUR_NODE_TYPE type
Type of this node.
Definition seymour_internal.h:20
CMR_ELEMENT ** childColumnsToParent
Array for mapping a child index to array of child columns to elements of this node.
Definition seymour_internal.h:38
CMR_GRAPH_EDGE * cographCoforest
Array with edges of coforest of cograph.
Definition seymour_internal.h:64
size_t numSeriesParallelReductions
Length of reductions.
Definition seymour_internal.h:69
size_t used
Reference counter.
Definition seymour_internal.h:19
DenseBinaryMatrix * denseMatrix
Dense support matrix for nested minors search. Rows and columns are not permuted, but pivots are appl...
Definition seymour_internal.h:75
size_t ** childSpecialRows
Array for mapping a child index to array of special child rows relevant for 2- and 3-sums.
Definition seymour_internal.h:40
CMR_ELEMENT * nestedMinorsRowsOriginal
Maps rows of nestedMinorsMatrix to elements of matrix.
Definition seymour_internal.h:90
size_t numRows
Length of rowsToChild.
Definition seymour_internal.h:45
size_t * rowsToChild
Array for mapping each row to a row of the child (if applicable).
Definition seymour_internal.h:46
size_t * nestedMinorsColumnsDense
Maps columns of nested minor sequence to columns of dense.
Definition seymour_internal.h:80
bool isTernary
Indicates whether this node belongs to a ternary matrix.
Definition seymour_internal.h:21
CMR_GRAPH_EDGE * graphCoforest
Array with edges of coforest of graph.
Definition seymour_internal.h:59
CMR_CHRMAT * matrix
Matrix representing this node.
Definition seymour_internal.h:32
CMR_SP_REDUCTION * seriesParallelReductions
Array of series-parallel reductions.
Definition seymour_internal.h:68
size_t * pivotColumns
Columns of pivots.
Definition seymour_internal.h:72