dists[source] = 0;
for (i=graph->sources[source]; i<graph->sources[source+1]; i++) {
int target = graph->targets[i];
- dists[target] = graph->weights[target];
+ dists[target] = graph->weights[i];
}
initHeap_f(&h, source, indices, dists, graph->n);
}
for (i=graph->sources[closest]; i<graph->sources[closest+1]; i++) {
int target = graph->targets[i];
- int weight = graph->weights[i];
+ float weight = graph->weights[i];
increaseKey_f(&h, target, d+weight, indices, dists);
}
}
node_t *target = (agtail(ep) == np) ? aghead(ep) : agtail(ep); // in case edge is reversed
graph->targets[n_edges] = ND_id(target);
graph->weights[n_edges] = ED_dist(ep);
- if (model == MODEL_SHORTPATH) {
- graph->weights[n_edges] = 1;
- } else if (model == MODEL_MDS) {
- assert(ED_dist(ep) > 0);
- graph->weights[n_edges] = ED_dist(ep);
- } else if (model == MODEL_SUBSET) {
- // perform reweighting later
- } else {
- assert(false); // circuit model not supported
- }
+ assert(graph->weights[n_edges] > 0);
n_edges++;
}
n_nodes++;
assert(n_edges == graph->sources[graph->n]);
graph->sources[n_nodes] = n_edges;
- if (model == MODEL_SUBSET) {
+ if (model == MODEL_SHORTPATH || model == MODEL_MDS) {
+ // TODO: fix MDS
+ } else if (model == MODEL_SUBSET) {
// i,j,k refer to actual node indices, while x,y refer to edge indices in graph->targets
int i;
bool *neighbours_i = N_NEW(graph->n, bool);
}
free(neighbours_i);
free(neighbours_j);
+ } else {
+ assert(false); // circuit model not supported
}
return graph;
}