Go to the documentation of this file.
28 idx_t i, ii, iii,
j, jj, k,
l, cnvtxs, cnedges;
29 idx_t *cxadj, *cadjncy, *cvwgt, *mark, *map;
33 mark =
ismalloc(nvtxs, -1,
"CompressGraph: mark");
34 map =
ismalloc(nvtxs, -1,
"CompressGraph: map");
38 for (
i=0;
i<nvtxs;
i++) {
49 for (cnvtxs=
i=0;
i<nvtxs;
i++) {
59 for (
j=
i+1;
j<nvtxs;
j++) {
66 for (jj=
xadj[iii]; jj<
xadj[iii+1]; jj++) {
71 if (jj ==
xadj[iii+1]) {
83 printf(
" Compression: reduction in # of vertices: %"PRIDX".\n", nvtxs-cnvtxs));
93 for (
i=0;
i<cnvtxs;
i++) {
99 cxadj =
graph->xadj =
imalloc(cnvtxs+1,
"CompressGraph: xadj");
100 cvwgt =
graph->vwgt =
ismalloc(cnvtxs, 0,
"CompressGraph: vwgt");
101 cadjncy =
graph->adjncy =
imalloc(cnedges,
"CompressGraph: adjncy");
102 graph->adjwgt =
ismalloc(cnedges, 1,
"CompressGraph: adjwgt");
105 iset(nvtxs, -1, mark);
107 for (
i=0;
i<cnvtxs;
i++) {
109 for (
j=cptr[
i];
j<cptr[
i+1];
j++) {
116 for (jj=
xadj[ii]; jj<
xadj[ii+1]; jj++) {
127 graph->nvtxs = cnvtxs;
153 idx_t i,
j, k,
l, nlarge, pnvtxs, pnedges;
154 idx_t *pxadj, *padjncy, *padjwgt, *pvwgt;
160 factor = factor*
xadj[nvtxs]/nvtxs;
162 pnvtxs = pnedges = nlarge = 0;
163 for (
i=0;
i<nvtxs;
i++) {
170 perm[
i] = nvtxs - ++nlarge;
176 printf(
" Pruned %"PRIDX" of %"PRIDX" vertices.\n", nlarge, nvtxs));
179 if (nlarge > 0 && nlarge < nvtxs) {
184 pxadj =
graph->xadj =
imalloc(pnvtxs+1,
"PruneGraph: xadj");
185 pvwgt =
graph->vwgt =
imalloc(pnvtxs,
"PruneGraph: vwgt");
186 padjncy =
graph->adjncy =
imalloc(pnedges,
"PruneGraph: adjncy");
189 pxadj[0] = pnedges =
l = 0;
190 for (
i=0;
i<nvtxs;
i++) {
197 padjncy[pnedges++] = k;
199 pxadj[++
l] = pnedges;
203 graph->nvtxs = pnvtxs;
204 graph->nedges = pnedges;
210 else if (nlarge > 0 && nlarge == nvtxs) {
212 printf(
" Pruning is ignored as it removes all vertices.\n"));
idx_t idx_t idx_t idx_t idx_t * perm
void gk_free(void **ptr1,...)
idx_t idx_t idx_t * adjncy
#define IFSET(a, flag, cmd)
graph_t * CompressGraph(ctrl_t *ctrl, idx_t nvtxs, idx_t *xadj, idx_t *adjncy, idx_t *vwgt, idx_t *cptr, idx_t *cind)
idx_t idx_t idx_t idx_t idx_t idx_t * iperm
static const Line3 l(Rot3(), 1, 1)
idx_t idx_t idx_t idx_t * vwgt
const gtsam::Symbol key('X', 0)
graph_t * PruneGraph(ctrl_t *ctrl, idx_t nvtxs, idx_t *xadj, idx_t *adjncy, idx_t *vwgt, idx_t *iperm, real_t factor)
NonlinearFactorGraph graph
#define COMPRESSION_FRACTION
gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:32:09