CMR  1.3.0
seymour.h
Go to the documentation of this file.
1 #ifndef CMR_SEYMOUR_H
2 #define CMR_SEYMOUR_H
3 
12 #include <cmr/env.h>
13 #include <cmr/matrix.h>
14 #include <cmr/matroid.h>
15 #include <cmr/graph.h>
16 #include <cmr/network.h>
17 #include <cmr/series_parallel.h>
18 
19 #include <stdio.h>
20 #include <stdint.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
39 typedef enum
40 {
87 
92 typedef struct
93 {
152 
159 CMR_EXPORT
161  CMR_SEYMOUR_PARAMS* params
162 );
163 
168 typedef struct
169 {
170  uint32_t totalCount;
171  double totalTime;
179  uint32_t enumerationCount;
183 
184 
189 CMR_EXPORT
191  CMR_SEYMOUR_STATS* stats
192 );
193 
198 CMR_EXPORT
200  FILE* stream,
201  CMR_SEYMOUR_STATS* stats,
202  const char* prefix
203 );
204 
205 
206 
207 struct _CMR_SEYMOUR_NODE;
208 
209 typedef struct _CMR_SEYMOUR_NODE CMR_SEYMOUR_NODE;
210 
211 typedef enum
212 {
237 
238 
243 CMR_EXPORT
245  CMR_SEYMOUR_NODE* node
246 );
247 
252 CMR_EXPORT
254  CMR_SEYMOUR_NODE* node
255 );
256 
261 CMR_EXPORT
263  CMR_SEYMOUR_NODE* node
264 );
265 
270 CMR_EXPORT
272  CMR_SEYMOUR_NODE* node
273 );
274 
279 CMR_EXPORT
281  CMR_SEYMOUR_NODE* node
282 );
283 
288 CMR_EXPORT
290  CMR_SEYMOUR_NODE* node
291 );
292 
297 CMR_EXPORT
298 size_t CMRseymourNumChildren(
299  CMR_SEYMOUR_NODE* node
300 );
301 
306 CMR_EXPORT
308  CMR_SEYMOUR_NODE* node,
309  size_t childIndex
310 );
311 
316 CMR_EXPORT
318  CMR_SEYMOUR_NODE* node
319 );
320 
325 CMR_EXPORT
326 size_t CMRseymourNumMinors(
327  CMR_SEYMOUR_NODE* node
328 );
329 
334 CMR_EXPORT
336  CMR_SEYMOUR_NODE* node,
337  size_t minorIndex
338 );
339 
347 CMR_EXPORT
348 int8_t CMRseymourGraphicness(
349  CMR_SEYMOUR_NODE* node
350 );
351 
359 CMR_EXPORT
361  CMR_SEYMOUR_NODE* node
362 );
363 
371 CMR_EXPORT
372 int8_t CMRseymourRegularity(
373  CMR_SEYMOUR_NODE* node
374 );
375 
380 CMR_EXPORT
381 size_t CMRseymourNumRows(
382  CMR_SEYMOUR_NODE* node
383 );
384 
389 CMR_EXPORT
390 size_t CMRseymourNumColumns(
391  CMR_SEYMOUR_NODE* node
392 );
393 
398 CMR_EXPORT
400  CMR_SEYMOUR_NODE* node,
401  size_t childIndex
402 );
403 
408 CMR_EXPORT
410  CMR_SEYMOUR_NODE* node,
411  size_t childIndex
412 );
413 
418 CMR_EXPORT
420  CMR_SEYMOUR_NODE* node
421 );
422 
427 CMR_EXPORT
429  CMR_SEYMOUR_NODE* node
430 );
431 
436 CMR_EXPORT
438  CMR_SEYMOUR_NODE* dec
439 );
440 
445 CMR_EXPORT
447  CMR_SEYMOUR_NODE* node
448 );
449 
454 CMR_EXPORT
456  CMR_SEYMOUR_NODE* node
457 );
458 
463 CMR_EXPORT
465  CMR_SEYMOUR_NODE* node
466 );
467 
472 CMR_EXPORT
474  CMR_SEYMOUR_NODE* node
475 );
476 
481 CMR_EXPORT
483  CMR_SEYMOUR_NODE* node
484 );
485 
490 CMR_EXPORT
492  CMR_SEYMOUR_NODE* node
493 );
494 
499 CMR_EXPORT
501  CMR_SEYMOUR_NODE* node
502 );
503 
508 CMR_EXPORT
510  CMR_SEYMOUR_NODE* node
511 );
512 
517 CMR_EXPORT
519  CMR_SEYMOUR_NODE* node
520 );
521 
526 CMR_EXPORT
527 size_t CMRseymourNumPivots(
528  CMR_SEYMOUR_NODE* node
529 );
530 
535 CMR_EXPORT
536 size_t* CMRseymourPivotRows(
537  CMR_SEYMOUR_NODE* node
538 );
539 
544 CMR_EXPORT
545 size_t* CMRseymourPivotColumns(
546  CMR_SEYMOUR_NODE* node
547 );
548 
553 CMR_EXPORT
554 size_t CMRseymourGetUsed(
555  CMR_SEYMOUR_NODE* node
556 );
557 
562 CMR_EXPORT
564  CMR* cmr,
565  CMR_SEYMOUR_NODE* node,
566  FILE* stream,
567  bool printChildren,
568  bool printParentElements,
569  bool printMatrices,
570  bool printGraphs,
571  bool printReductions,
572  bool printPivots
573 );
574 
579 CMR_EXPORT
581  CMR* cmr,
582  CMR_SEYMOUR_NODE* node
583 );
584 
592 CMR_EXPORT
594  CMR* cmr,
595  CMR_SEYMOUR_NODE** pnode
596 );
597 
604 CMR_EXPORT
606  CMR* cmr,
607  CMR_SEYMOUR_NODE** pnode,
608  bool isTernary,
610 );
611 
617 CMR_EXPORT
619  CMR* cmr,
620  CMR_SEYMOUR_NODE* node,
621  CMR_SEYMOUR_NODE** pclone
622 );
623 
631 CMR_EXPORT
632 CMR_ERROR CMRseymourCloneSubtrees(CMR* cmr, size_t numSubtrees, CMR_SEYMOUR_NODE** subtreeRoots,
633  CMR_SEYMOUR_NODE** clonedSubtrees);
634 
637 #ifdef __cplusplus
638 }
639 #endif
640 
641 #endif /* CMR_SEYMOUR_H */
int CMR_ELEMENT
Definition: element.h:20
Basic functionality of the software library.
CMR_ERROR
Type for return codes of library functions.
Definition: env.h:32
Functionality for graphs.
int CMR_GRAPH_EDGE
Reference to an edge of CMR_GRAPH.
Definition: graph.h:31
CMR_EXPORT bool CMRseymourHasTranspose(CMR_SEYMOUR_NODE *node)
Returns true iff the transposed matrix of the decomposition node dec is stored.
Definition: seymour.c:120
CMR_EXPORT int8_t CMRseymourCographicness(CMR_SEYMOUR_NODE *node)
Indicates cographicness/being conetwork.
Definition: seymour.c:164
CMR_EXPORT CMR_ELEMENT * CMRseymourChildRowsToParent(CMR_SEYMOUR_NODE *node, size_t childIndex)
Returns the mapping of rows of child childIndex to this node's elements.
Definition: seymour.c:185
CMR_EXPORT size_t CMRseymourNumPivots(CMR_SEYMOUR_NODE *node)
Returns the number of pivots (if available).
Definition: seymour.c:324
CMR_EXPORT size_t CMRseymourNumRows(CMR_SEYMOUR_NODE *node)
Returns the number of rows.
Definition: seymour.c:178
CMR_EXPORT size_t CMRseymourGetUsed(CMR_SEYMOUR_NODE *node)
Returns node's reference counter.
Definition: seymour.c:345
CMR_EXPORT size_t CMRseymourCographSizeForest(CMR_SEYMOUR_NODE *node)
Returns the number of edges of the cograph's forest (if available).
Definition: seymour.c:275
CMR_EXPORT bool CMRseymourIsTernary(CMR_SEYMOUR_NODE *node)
Returns true iff the decomposition is over .
Definition: seymour.c:90
CMR_EXPORT CMR_CHRMAT * CMRseymourGetTranspose(CMR_SEYMOUR_NODE *node)
Returns the transposed matrix of the decomposition node dec (or NULL if it is not stored).
Definition: seymour.c:127
CMR_EXPORT CMR_SEYMOUR_NODE * CMRseymourChild(CMR_SEYMOUR_NODE *node, size_t childIndex)
Returns a child of the decomposition node dec.
Definition: seymour.c:141
CMR_EXPORT CMR_GRAPH * CMRseymourCograph(CMR_SEYMOUR_NODE *node)
Returns the cograph (if available).
Definition: seymour.c:268
CMR_EXPORT CMR_ELEMENT * CMRseymourChildColumnsToParent(CMR_SEYMOUR_NODE *node, size_t childIndex)
Returns the mapping of columns of child childIndex to this node's elements.
Definition: seymour.c:195
CMR_EXPORT CMR_ERROR CMRseymourRelease(CMR *cmr, CMR_SEYMOUR_NODE **pnode)
Releases a decomposition node, freeing it if this was the last reference.
Definition: seymour.c:587
CMR_EXPORT size_t CMRseymourNumChildren(CMR_SEYMOUR_NODE *node)
Returns the number of children of the decomposition node dec.
Definition: seymour.c:134
CMR_EXPORT CMR_ERROR CMRseymourCapture(CMR *cmr, CMR_SEYMOUR_NODE *node)
Increases the reference counter by 1.
Definition: seymour.c:575
CMR_EXPORT CMR_GRAPH * CMRseymourGraph(CMR_SEYMOUR_NODE *node)
Returns the graph (if available).
Definition: seymour.c:212
CMR_EXPORT bool * CMRseymourGraphArcsReversed(CMR_SEYMOUR_NODE *node)
Returns an array that indicates for the graph's edges whether they must be reversed (if available).
Definition: seymour.c:261
CMR_SEYMOUR_THREESUM_FLAG
Flags that indicate the type of -separation.
Definition: seymour.h:40
CMR_EXPORT CMR_ERROR CMRseymourCreate(CMR *cmr, CMR_SEYMOUR_NODE **pnode, bool isTernary, CMR_CHRMAT *matrix)
Creates an unknown decomposition node as a root.
Definition: seymour.c:896
CMR_EXPORT CMR_GRAPH_EDGE * CMRseymourGraphCoforest(CMR_SEYMOUR_NODE *node)
Returns the coforest of the graph (if available).
Definition: seymour.c:240
CMR_EXPORT int8_t CMRseymourGraphicness(CMR_SEYMOUR_NODE *node)
Indicates graphicness/being network.
Definition: seymour.c:157
CMR_EXPORT size_t CMRseymourCographSizeCoforest(CMR_SEYMOUR_NODE *node)
Returns the number of edges of the cograph's coforest (if available).
Definition: seymour.c:296
CMR_EXPORT size_t * CMRseymourPivotColumns(CMR_SEYMOUR_NODE *node)
Returns the array with the pivot columns (if available).
Definition: seymour.c:338
CMR_EXPORT CMR_ERROR CMRseymourPrint(CMR *cmr, CMR_SEYMOUR_NODE *node, FILE *stream, bool printChildren, bool printParentElements, bool printMatrices, bool printGraphs, bool printReductions, bool printPivots)
Prints the decomposition dec to stream.
Definition: seymour.c:563
CMR_EXPORT size_t CMRseymourNumColumns(CMR_SEYMOUR_NODE *node)
Returns the number of columns.
Definition: seymour.c:205
CMR_EXPORT bool CMRseymourThreeSumConcentratedRank(CMR_SEYMOUR_NODE *node)
Returns true iff the 3-sum decomposition node has -separation with one rank-2 matrix.
Definition: seymour.c:105
CMR_EXPORT CMR_SEYMOUR_NODE_TYPE CMRseymourType(CMR_SEYMOUR_NODE *node)
Returns the type of a decomposition node dec.
Definition: seymour.c:149
CMR_SEYMOUR_NODE_TYPE
Definition: seymour.h:212
CMR_EXPORT size_t CMRseymourGraphSizeCoforest(CMR_SEYMOUR_NODE *node)
Returns the number of edges of the graph's coforest (if available).
Definition: seymour.c:247
CMR_EXPORT CMR_ERROR CMRseymourCloneUnknown(CMR *cmr, CMR_SEYMOUR_NODE *node, CMR_SEYMOUR_NODE **pclone)
Clones a decomposition node node into *pclone which represents the same matrix but has type CMR_SEYMO...
Definition: seymour.c:754
CMR_EXPORT CMR_MINOR * CMRseymourMinor(CMR_SEYMOUR_NODE *node, size_t minorIndex)
Returns a minor of the decomposition node.
Definition: seymour.c:937
CMR_EXPORT CMR_ERROR CMRseymourStatsInit(CMR_SEYMOUR_STATS *stats)
Initializes all statistics for Seymour decomposition computations.
Definition: seymour.c:37
CMR_EXPORT CMR_ERROR CMRseymourParamsInit(CMR_SEYMOUR_PARAMS *params)
Initializes the default parameters for regularity testing.
Definition: seymour.c:15
CMR_EXPORT size_t CMRseymourNumMinors(CMR_SEYMOUR_NODE *node)
Returns the number of minors of the decomposition node.
Definition: seymour.c:930
CMR_EXPORT int8_t CMRseymourRegularity(CMR_SEYMOUR_NODE *node)
Indicates regularity/total unimodularity.
Definition: seymour.c:171
CMR_EXPORT CMR_ERROR CMRseymourStatsPrint(FILE *stream, CMR_SEYMOUR_STATS *stats, const char *prefix)
Prints statistics for Seymour decomposition computations.
Definition: seymour.c:57
CMR_EXPORT CMR_GRAPH_EDGE * CMRseymourGraphForest(CMR_SEYMOUR_NODE *node)
Returns the forest of the graph (if available).
Definition: seymour.c:219
CMR_EXPORT CMR_GRAPH_EDGE * CMRseymourCographForest(CMR_SEYMOUR_NODE *node)
Returns the forest of the cograph (if available).
Definition: seymour.c:289
CMR_EXPORT size_t CMRseymourGraphSizeForest(CMR_SEYMOUR_NODE *dec)
Returns the number of edges of the graph's forest (if available).
Definition: seymour.c:226
CMR_EXPORT CMR_GRAPH_EDGE * CMRseymourCographCoforest(CMR_SEYMOUR_NODE *node)
Returns the coforest of the cograph (if available).
Definition: seymour.c:310
CMR_EXPORT bool * CMRseymourCographArcsReversed(CMR_SEYMOUR_NODE *node)
Returns an array that indicates for the cograph's edges whether they must be reversed (if available).
Definition: seymour.c:317
CMR_EXPORT bool CMRseymourThreeSumDistributedRanks(CMR_SEYMOUR_NODE *node)
Returns true iff the 3-sum decomposition node has -separation with two rank-1 matrices.
Definition: seymour.c:97
CMR_EXPORT size_t * CMRseymourPivotRows(CMR_SEYMOUR_NODE *node)
Returns the array with the pivot rows (if available).
Definition: seymour.c:331
CMR_EXPORT CMR_ERROR CMRseymourCloneSubtrees(CMR *cmr, size_t numSubtrees, CMR_SEYMOUR_NODE **subtreeRoots, CMR_SEYMOUR_NODE **clonedSubtrees)
Clones the union of subtrees of a Seymour decomposition, returning the copies.
Definition: seymour.c:2022
CMR_EXPORT CMR_CHRMAT * CMRseymourGetMatrix(CMR_SEYMOUR_NODE *node)
Returns the matrix of the decomposition node dec (or NULL if it is not stored).
Definition: seymour.c:113
@ CMR_SEYMOUR_THREESUM_FLAG_FIRST_MIXED
Definition: seymour.h:58
@ CMR_SEYMOUR_THREESUM_FLAG_FIRST_ALLREPR
Definition: seymour.h:61
@ CMR_SEYMOUR_THREESUM_FLAG_SECOND_WIDE
Definition: seymour.h:65
@ CMR_SEYMOUR_THREESUM_FLAG_FIRST_TALL
Definition: seymour.h:55
@ CMR_SEYMOUR_THREESUM_FLAG_SECOND_TALL
Definition: seymour.h:68
@ CMR_SEYMOUR_THREESUM_FLAG_NO_PIVOTS
Definition: seymour.h:41
@ CMR_SEYMOUR_THREESUM_FLAG_TRUEMPER
Definition: seymour.h:82
@ CMR_SEYMOUR_THREESUM_FLAG_CONCENTRATED_RANK
Definition: seymour.h:48
@ CMR_SEYMOUR_THREESUM_FLAG_SECOND_MIXED
Definition: seymour.h:71
@ CMR_SEYMOUR_THREESUM_FLAG_SEYMOUR
Definition: seymour.h:78
@ CMR_SEYMOUR_THREESUM_FLAG_DISTRIBUTED_RANKS
Definition: seymour.h:45
@ CMR_SEYMOUR_THREESUM_FLAG_SECOND_ALLREPR
Definition: seymour.h:74
@ CMR_SEYMOUR_THREESUM_FLAG_FIRST_WIDE
Definition: seymour.h:52
@ CMR_SEYMOUR_NODE_TYPE_UNKNOWN
Definition: seymour.h:215
@ CMR_SEYMOUR_NODE_TYPE_SERIES_PARALLEL
Definition: seymour.h:223
@ CMR_SEYMOUR_NODE_TYPE_ONE_SUM
Definition: seymour.h:217
@ CMR_SEYMOUR_NODE_TYPE_PLANAR
Definition: seymour.h:232
@ CMR_SEYMOUR_NODE_TYPE_PIVOTS
Definition: seymour.h:225
@ CMR_SEYMOUR_NODE_TYPE_THREE_SUM
Definition: seymour.h:221
@ CMR_SEYMOUR_NODE_TYPE_R10
Definition: seymour.h:234
@ CMR_SEYMOUR_NODE_TYPE_TWO_SUM
Definition: seymour.h:219
@ CMR_SEYMOUR_NODE_TYPE_IRREGULAR
Definition: seymour.h:213
@ CMR_SEYMOUR_NODE_TYPE_GRAPH
Definition: seymour.h:228
@ CMR_SEYMOUR_NODE_TYPE_COGRAPH
Definition: seymour.h:230
Functionality for sparse matrices.
Functionality for matroids.
Computation and recognition of network matrices and conetwork matrices.
Recognition of series-parallel matrices.
Row-wise representation of sparse char matrix.
Definition: matrix.h:220
Definition: env_internal.h:45
Statistics for graphicness test.
Definition: graphic.h:34
Definition: graph.h:49
A minor of a matroid.
Definition: matroid.h:121
Statistics for recognition algorithm for network matrices.
Definition: network.h:36
Parameters for Seymour decomposition algorithm.
Definition: seymour.h:93
bool threeSumPivotChildren
Whether pivots for 3-sums shall be applied such that the matrix contains both child matrices as subma...
Definition: seymour.h:113
int threeSumStrategy
Whether to perform pivots to change the rank distribution, and how to construct the children.
Definition: seymour.h:116
bool planarityCheck
Whether minors identified as graphic should still be checked for cographicness; default: false.
Definition: seymour.h:106
bool constructLeafGraphs
Whether to construct (co)graphs for all leaf nodes that are (co)graphic or (co)network.
Definition: seymour.h:147
bool stopWhenNongraphic
Whether to stop decomposing once non-graphicness (or being non-network) is determined.
Definition: seymour.h:96
bool preferGraphicness
Whether to first test for (co)graphicness (or being (co)network) before applying series-parallel redu...
Definition: seymour.h:110
bool stopWhenNoncographic
Whether to stop decomposing once non-cographicness (or being non-conetwork) is determined.
Definition: seymour.h:98
bool directGraphicness
Whether to use fast graphicness routines; default: true.
Definition: seymour.h:108
bool seriesParallel
Whether to allow series-parallel operations in the decomposition tree; default: true.
Definition: seymour.h:104
bool stopWhenNeitherGraphicNorCoGraphic
Whether to stop decomposing once non-graphicness and non-cographicness (or not being network and not ...
Definition: seymour.h:100
bool constructAllGraphs
Whether to construct (co)graphs for all nodes that are (co)graphic or (co)network.
Definition: seymour.h:149
bool stopWhenIrregular
Whether to stop decomposing once irregularity is determined.
Definition: seymour.h:94
Statistics for Seymour decomposition algorithm.
Definition: seymour.h:169
CMR_NETWORK_STATISTICS network
Definition: seymour.h:174
CMR_SP_STATISTICS seriesParallel
Definition: seymour.h:172
double sequenceGraphicTime
Definition: seymour.h:178
double sequenceExtensionTime
Definition: seymour.h:176
uint32_t enumerationCandidatesCount
Definition: seymour.h:181
double enumerationTime
Definition: seymour.h:180
double totalTime
Definition: seymour.h:171
uint32_t enumerationCount
Definition: seymour.h:179
uint32_t sequenceGraphicCount
Definition: seymour.h:177
CMR_GRAPHIC_STATISTICS graphic
Definition: seymour.h:173
uint32_t sequenceExtensionCount
Definition: seymour.h:175
uint32_t totalCount
Definition: seymour.h:170
Statistics for series-parallel recognition algorithm.
Definition: series_parallel.h:25
Definition: seymour_internal.h:18
bool isTernary
Indicates whether this node belongs to a ternary matrix.
Definition: seymour_internal.h:21
CMR_CHRMAT * matrix
Matrix representing this node.
Definition: seymour_internal.h:32