* Contributors: Details at https://graphviz.org
*************************************************************************/
+#include <assert.h>
+#include <cgraph/bitarray.h>
#include <dotgen/dot.h>
+#include <stddef.h>
/*
* Author: Mohammad T. Irfan
typedef struct layerWidthInfo_t {
int layerNumber;
nodeGroup_t **nodeGroupsInLayer;
- int *removed; /* is the node group removed? */
+ bitarray_t removed; // is the node group removed?
int nNodeGroupsInLayer;
int nDummyNodes;
double width;
}
free(layerWidthInfo[i].nodeGroupsInLayer);
}
- free(layerWidthInfo[i].removed);
+ bitarray_reset(&layerWidthInfo[i].removed);
}
free(layerWidthInfo);
layerWidthInfo[i].nodeGroupsInLayer =
N_NEW(nNodeGroups, nodeGroup_t *);
- layerWidthInfo[i].removed = N_NEW(nNodeGroups, int);
+ assert(nNodeGroups >= 0);
+ layerWidthInfo[i].removed = bitarray_new_or_exit((size_t)nNodeGroups);
layerWidthInfo[i].layerNumber = i;
layerWidthInfo[i].nNodeGroupsInLayer = 0;
w = 0;
for (i = 0; i < limit + rem; i++) {
- if (layerWidthInfo[maxLayerIndex].removed[i]) {
+ if (bitarray_get(layerWidthInfo[maxLayerIndex].removed, i)) {
rem++;
continue;
}
/* the following code updates the layer width information. The
* update is not useful in the current version of the heuristic.
*/
- layerWidthInfo[maxLayerIndex].removed[i] = 1;
+ bitarray_set(&layerWidthInfo[maxLayerIndex].removed, i, true);
rem2++;
layerWidthInfo[maxLayerIndex].nNodeGroupsInLayer--;
/* SHOULD BE INCREASED BY THE SUM OF INDEG OF ALL NODES IN GROUP */