mirror of https://gitee.com/bigwinds/arangodb
fixed betweeness and bug in floyd warshall
This commit is contained in:
parent
2eb42db0d7
commit
ff8791f6fb
|
@ -5243,15 +5243,29 @@ function CALCULATE_SHORTEST_PATHES_WITH_FLOYD_WARSHALL (graphData, options) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
var transformPath = function (paths) {
|
||||||
|
paths.forEach(function (p) {
|
||||||
|
var vTmp = [];
|
||||||
|
p.vertices.forEach(function (v) {
|
||||||
|
if (graph.fromVerticesIDs[v]) {
|
||||||
|
vTmp.push(graph.fromVerticesIDs[v]);
|
||||||
} else {
|
} else {
|
||||||
delete paths[i][j].paths;
|
vTmp.push(graph.toVerticesIDs[v]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
p.vertices = vTmp;
|
||||||
|
});
|
||||||
|
return paths;
|
||||||
|
};
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Object.keys(paths).forEach(function (from) {
|
Object.keys(paths).forEach(function (from) {
|
||||||
if (!graph.fromVerticesIDs[from]) {
|
if (!graph.fromVerticesIDs[from]) {
|
||||||
return;
|
return;
|
||||||
|
@ -5272,7 +5286,7 @@ function CALCULATE_SHORTEST_PATHES_WITH_FLOYD_WARSHALL (graphData, options) {
|
||||||
result.push({
|
result.push({
|
||||||
startVertex : from,
|
startVertex : from,
|
||||||
vertex : graph.toVerticesIDs[to],
|
vertex : graph.toVerticesIDs[to],
|
||||||
paths : options.noPaths ? null : paths[from][to].paths,
|
paths : options.noPaths ? null : transformPath(paths[from][to].paths),
|
||||||
distance : paths[from][to].distance
|
distance : paths[from][to].distance
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -5392,7 +5406,8 @@ function IS_EXAMPLE_SET (example) {
|
||||||
return (
|
return (
|
||||||
example && (
|
example && (
|
||||||
(Array.isArray(example) && example.length > 0) ||
|
(Array.isArray(example) && example.length > 0) ||
|
||||||
(typeof example === "object" && Object.keys(example) > 0)
|
(typeof example === "object" && Object.keys(example) > 0) ||
|
||||||
|
typeof example === "string"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -6902,13 +6917,13 @@ function GENERAL_GRAPH_ABSOLUTE_BETWEENNESS (graphName, options) {
|
||||||
}
|
}
|
||||||
d.paths.forEach(function (p) {
|
d.paths.forEach(function (p) {
|
||||||
p.vertices.forEach(function (v) {
|
p.vertices.forEach(function (v) {
|
||||||
if (v === d.startVertex || v === d.vertex._id) {
|
if (v._id === d.startVertex || v._id === d.vertex._id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!tmp[v]) {
|
if (!tmp[v._id]) {
|
||||||
tmp[v] = 1;
|
tmp[v._id] = 1;
|
||||||
} else {
|
} else {
|
||||||
tmp[v]++;
|
tmp[v._id]++;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue