mirror of
https://github.com/anvaka/ngraph.path.git
synced 2026-01-18 15:13:12 +00:00
moved helper functions to default settings
This commit is contained in:
parent
d89a962a1e
commit
91ebc37fcd
@ -11,7 +11,13 @@ module.exports = {
|
||||
NO_PATH: NO_PATH,
|
||||
|
||||
// heap settings
|
||||
setHeapIndex: setHeapIndex
|
||||
setHeapIndex: setHeapIndex,
|
||||
|
||||
// nba:
|
||||
setH1: setH1,
|
||||
setH2: setH2,
|
||||
compareF1Score: compareF1Score,
|
||||
compareF2Score: compareF2Score,
|
||||
}
|
||||
|
||||
function blindHeuristic(/* a, b */) {
|
||||
@ -32,4 +38,20 @@ function compareFScore(a, b) {
|
||||
|
||||
function setHeapIndex(nodeSearchState, heapIndex) {
|
||||
nodeSearchState.heapIndex = heapIndex;
|
||||
}
|
||||
|
||||
function compareF1Score(a, b) {
|
||||
return a.f1 - b.f1;
|
||||
}
|
||||
|
||||
function compareF2Score(a, b) {
|
||||
return a.f2 - b.f2;
|
||||
}
|
||||
|
||||
function setH1(node, heapIndex) {
|
||||
node.h1 = heapIndex;
|
||||
}
|
||||
|
||||
function setH2(node, heapIndex) {
|
||||
node.h2 = heapIndex;
|
||||
}
|
||||
@ -60,12 +60,12 @@ function nba(graph, options) {
|
||||
|
||||
// the nodes that we still need to evaluate
|
||||
var open1Set = new NodeHeap({
|
||||
compare: function(a, b) { return a.f1 - b.f1; },
|
||||
setNodeId: function(node, heapIndex) { node.h1 = heapIndex }
|
||||
compare: defaultSettings.compareF1Score,
|
||||
setNodeId: defaultSettings.setH1
|
||||
});
|
||||
var open2Set = new NodeHeap({
|
||||
compare: function(a, b) { return a.f2 - b.f2; },
|
||||
setNodeId: function(node, heapIndex) { node.h2 = heapIndex }
|
||||
compare: defaultSettings.compareF2Score,
|
||||
setNodeId: defaultSettings.setH2
|
||||
});
|
||||
|
||||
var minNode;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user