/* Copyright (C) 2019-2020, Dirk Krause SPDX-License-Identifier: BSD-3-Clause */ /* WARNING: This file was generated by the dkct program (see http://dktools.sourceforge.net/ for details). Changes you make here will be lost if dkct is run again! You should modify the original source and run dkct on it. Original source: dk4bml.ctr */ #ifndef DK4BML_H_INCLUDED /** Avoid multiple inclusions. */ #define DK4BML_H_INCLUDED 1 #line 9 "dk4bml.ctr" /** @file dk4bml.h Levelize graph using a bit matrix. Levelizing means counting the path length from start nodes (nodes with no predecessor) to a certain node. Levelizing here must be able to handle loops. Two nodes are in the same loop if there is both a path from one node to the other and a path vice versa. Node a is a one-way predecessor of node b if a is a predecessor of b and there is a path from a to b but not path from b to a. This means a and b are not in the same loop. Nodes without a predecessor are level 0 nodes. In each pass all nodes not yet evaluated are checked. A node is evaluated if at least all one-way predecessor nodes are evaluated. The nodes value/level is the maximum value of all (not just the one-way) predecessors already evaluated, increased by one. */ #ifndef DK4BM_H_INCLUDED #if DK4_BUILDING_DKTOOLS4 #include "dk4bm.h" #else #include #endif #endif #ifdef __cplusplus extern "C" { #endif /** Levelize graph nodes. CRT on Windows: Optional. @param pdest Destination array for the node levels. @param szdest Size of destination array. @param pbm Bit matrix representing the graph. @param isrev Flag: Reverse notation is used in pbm. @param erp Error report, may be NULL. @return 1 on success, 0 on error. Error codes: - DK4_E_INVALID_ARGUMENTS
if pdest or pbm is NULL or szdest is 0, - DK4_E_SYNTAX
if the matrix is not square or szdest is smaller then the number of rows, - DK4_E_MATH_OVERFLOW
if a numeric overflow happens in size calculations for temporary data, - DK4_E_MEMORY_ALLOCATION_FAILED
if a memory allocation attempt for temporary data fails. */ int dk4bm_levelize( size_t *pdest, size_t szdest, dk4_bit_matrix_t const *pbm, int isrev, dk4_er_t *erp ); /** Levelize graph nodes. CRT on Windows: Optional. @param pdest Destination array for the node levels. @param szdest Size of destination array. @param pbm Bit matrix representing the graph, must already be expanded. @param isrev Flag: Reverse notation is used in pbm. @param erp Error report, may be NULL. @return 1 on success, 0 on error. Error codes: - DK4_E_INVALID_ARGUMENTS
if pdest or pbm is NULL or szdest is 0, - DK4_E_SYNTAX
if the matrix is not square or szdest is smaller then the number of rows, - DK4_E_MATH_OVERFLOW
if a numeric overflow happens in size calculations for temporary data, - DK4_E_MEMORY_ALLOCATION_FAILED
if a memory allocation attempt for temporary data fails. */ int dk4bm_levelize_expanded( size_t *pdest, size_t szdest, dk4_bit_matrix_t const *pbm, int isrev, dk4_er_t *erp ); #ifdef __cplusplus } #endif #endif