CMR  1.3.0
Classes | Functions
network.h File Reference

Computation and recognition of network matrices and conetwork matrices. More...

#include <cmr/env.h>
#include <cmr/element.h>
#include <cmr/matrix.h>
#include <cmr/graph.h>
#include <cmr/graphic.h>
#include <cmr/camion.h>
#include <stdio.h>
#include <stdint.h>

Go to the source code of this file.

Classes

struct  CMR_NETWORK_STATISTICS
 Statistics for recognition algorithm for network matrices. More...
 

Functions

CMR_EXPORT CMR_ERROR CMRnetworkStatsInit (CMR_NETWORK_STATISTICS *stats)
 Initializes all statistics for recognition algorithm for network matrices. More...
 
CMR_EXPORT CMR_ERROR CMRnetworkStatsPrint (FILE *stream, CMR_NETWORK_STATISTICS *stats, const char *prefix)
 Prints statistics for recognition algorithm for network matrices. More...
 
CMR_EXPORT CMR_ERROR CMRnetworkComputeMatrix (CMR *cmr, CMR_GRAPH *digraph, CMR_CHRMAT **pmatrix, CMR_CHRMAT **ptranspose, bool *arcsReversed, int numForestArcs, CMR_GRAPH_EDGE *forestArcs, int numCoforestArcs, CMR_GRAPH_EDGE *coforestArcs, bool *pisCorrectForest)
 Computes the network matrix of a given digraph \( D = (V,A) \). More...
 
CMR_EXPORT CMR_ERROR CMRnetworkTestMatrix (CMR *cmr, CMR_CHRMAT *matrix, bool *pisNetwork, bool *psupportIsGraphic, CMR_GRAPH **pdigraph, CMR_GRAPH_EDGE **pforestArcs, CMR_GRAPH_EDGE **pcoforestArcs, bool **parcsReversed, CMR_SUBMAT **psubmatrix, CMR_NETWORK_STATISTICS *stats, double timeLimit)
 Tests a matrix \( M \) for being a network matrix. More...
 
CMR_EXPORT CMR_ERROR CMRnetworkTestTranspose (CMR *cmr, CMR_CHRMAT *matrix, bool *pisConetwork, bool *psupportIsCographic, CMR_GRAPH **pdigraph, CMR_GRAPH_EDGE **pforestArcs, CMR_GRAPH_EDGE **pcoforestArcs, bool **parcsReversed, CMR_SUBMAT **psubmatrix, CMR_NETWORK_STATISTICS *stats, double timeLimit)
 Tests a matrix \( M \) for being a conetwork matrix. More...
 

Detailed Description

Computation and recognition of network matrices and conetwork matrices.

Author
Matthias Walter

The following notation is used throughout:

Function Documentation

◆ CMRnetworkComputeMatrix()

CMR_EXPORT CMR_ERROR CMRnetworkComputeMatrix ( CMR cmr,
CMR_GRAPH digraph,
CMR_CHRMAT **  pmatrix,
CMR_CHRMAT **  ptranspose,
bool *  arcsReversed,
int  numForestArcs,
CMR_GRAPH_EDGE forestArcs,
int  numCoforestArcs,
CMR_GRAPH_EDGE coforestArcs,
bool *  pisCorrectForest 
)

Computes the network matrix of a given digraph \( D = (V,A) \).

Computes the network matrix \( M := M(D,T) \) for given \( D \) and optionally given (directed) spanning forest \( T \subseteq A \). If \( T \) is not given, an arbitrary (directed) spanning forest of \( D \) is used. The direction of the edges is that of digraph, but may be flipped by specifying arcsReversed. If forestArcs is NULL, an arbitrary (directed) spanning forest \( T \) of \( D \) is computed. The ordering of the columns can be specified via coforestArcs.

Note
The function computes a network matrix of \( D \) (and \( T \)) regardless of whether forestArcs is a correct (directed) spanning forest. Whether this was the case is indicated via *pisCorrectForest.
Parameters
cmrCMR environment.
digraphDigraph \( D = (V,A) \).
pmatrixPointer for storing \( M \) (may be NULL).
ptransposePointer for storing \( M^{\mathsf{T}} \) (may be NULL).
arcsReversedIndicates, for each edge \( \{u, v\}\), whether we consider \( (u, v)\) (if false) or \( (v,u)\) (if true).
numForestArcs\( |T| \) (0 if forestArcs is NULL).
forestArcs\( T \), ordered by the rows of \( M \) (may be NULL).
numCoforestArcs\( |A \setminus T| \) (0 if coforestArcs is NULL).
coforestArcs\( A \setminus T \), ordered by the columns of \( M \) (may be NULL).
pisCorrectForestPointer for storing whether forestArcs is a (directed) spanning forest of \( D \)'s underlying undirected graph (may be NULL).

◆ CMRnetworkStatsInit()

CMR_EXPORT CMR_ERROR CMRnetworkStatsInit ( CMR_NETWORK_STATISTICS stats)

Initializes all statistics for recognition algorithm for network matrices.

Parameters
statsPointer to statistics.

◆ CMRnetworkStatsPrint()

CMR_EXPORT CMR_ERROR CMRnetworkStatsPrint ( FILE *  stream,
CMR_NETWORK_STATISTICS stats,
const char *  prefix 
)

Prints statistics for recognition algorithm for network matrices.

Parameters
streamFile stream to print to.
statsPointer to statistics.
prefixPrefix string to prepend to each printed line (may be NULL).

◆ CMRnetworkTestMatrix()

CMR_EXPORT CMR_ERROR CMRnetworkTestMatrix ( CMR cmr,
CMR_CHRMAT matrix,
bool *  pisNetwork,
bool *  psupportIsGraphic,
CMR_GRAPH **  pdigraph,
CMR_GRAPH_EDGE **  pforestArcs,
CMR_GRAPH_EDGE **  pcoforestArcs,
bool **  parcsReversed,
CMR_SUBMAT **  psubmatrix,
CMR_NETWORK_STATISTICS stats,
double  timeLimit 
)

Tests a matrix \( M \) for being a network matrix.

Tests if \( M = M(D,T) \) for some digraph \( D = (V,A) \) and some (directed) spanning forest \( T \subseteq A \) of \( D \) and sets *pisNetwork accordingly.

Note
If a column-wise representation of \( M \) is available, it is recommended to call CMRtestConetworkMatrix() for that. In fact, the implementation explicitly constructs \( M^{\mathsf{T}} \) before calling this function.

If \( M \) is a network matrix and pdigraph != NULL, then one possible digraph \( D \) is computed and stored in *pdigraph. The caller must release its memory via CMRgraphFree. If in addition to pdigraph also pforestArcs != NULL (resp. pcoforestArcs != NULL), then a corresponding (directed) spanning forest \( T \) (resp. its complement \( A \setminus T \)) is stored in *pforestArcs (resp. *pcoforestArcs). The caller must release this memory via CMRfreeBlockArray.

Note
Retrieval of minimal non-network submatrices via *psubmatrix is not implemented, yet.
Parameters
cmrCMR environment.
matrixMatrix \( M \).
pisNetworkPointer for storing true if and only if \( M \) is a network matrix.
psupportIsGraphicPointer for storing true if and only if the support matrix is graphic.
pdigraphPointer for storing the digraph \( D \) (if \( M \) is network).
pforestArcsPointer for storing \( T \), indexed by the rows of \( M \) (if \( M \) is network).
pcoforestArcsPointer for storing \( A \setminus T \), indexed by the columns of \( M \) (if \( M \) is network).
parcsReversedPointer for storing indicators which arcs are reversed for the correct sign (if \( M \) is network).
psubmatrixPointer for storing a minimal non-network submatrix (if \( M \) is not network).
statsPointer to statistics (may be NULL).
timeLimitTime limit to impose.

◆ CMRnetworkTestTranspose()

CMR_EXPORT CMR_ERROR CMRnetworkTestTranspose ( CMR cmr,
CMR_CHRMAT matrix,
bool *  pisConetwork,
bool *  psupportIsCographic,
CMR_GRAPH **  pdigraph,
CMR_GRAPH_EDGE **  pforestArcs,
CMR_GRAPH_EDGE **  pcoforestArcs,
bool **  parcsReversed,
CMR_SUBMAT **  psubmatrix,
CMR_NETWORK_STATISTICS stats,
double  timeLimit 
)

Tests a matrix \( M \) for being a conetwork matrix.

Tests if \( M = M(D,T)^{\mathsf{T}} \) for some digraph \( D = (V,A) \) and some (directed) spanning forest \( T \subseteq A \) of \( D \) and sets *pisConetwork accordingly.

If \( M \) is a conetwork matrix and pdigraph != NULL, then one possible digraph \( D \) is computed and stored in *pdigraph. The caller must release its memory via CMRgraphFree. If in addition to pdigraph also pforestArcs != NULL (resp. pcoforestArcs != NULL), then a corresponding (directed) spanning forest \( T \) (resp. its complement \( A \setminus T \)) is stored in *pforestArcs (resp. *pcoforestArcs). The caller must release this memory via CMRfreeBlockArray.

Note
Retrieval of minimal non-conetwork submatrices via *psubmatrix is not implemented, yet.
Parameters
cmrCMR environment.
matrixMatrix \( M \).
pisConetworkReturns true if and only if \( M \) is a conetwork matrix.
psupportIsCographicPointer for storing true if and only if the support matrix is cographic.
pdigraphPointer for storing true if and only if \( M \) is conetwork.
pforestArcsPointer for storing \( T \), indexed by the columns of \( M \) (if \( M \) is network).
pcoforestArcsPointer for storing \( A \setminus T \), indexed by the rows of \( M \) (if \( M \) is conetwork).
parcsReversedPointer for storing indicators which arcs are reversed for the correct sign (if \( M \) is conetwork).
psubmatrixPointer for storing a minimal non-conetwork submatrix (if \( M \) is not conetwork).
statsPointer to statistics (may be NULL).
timeLimitTime limit to impose.