Skip to content

Unable to use blocked and distance #41

@nalasark

Description

@nalasark

When I create a pathfinder that uses both blocked and distance, the blocked always gets ignored.
Am I doing something wrong?

graph.addLink("shopA","liftA",{weight:10, wheelchair: true});
graph.addLink("liftA","liftB",{weight:1, wheelchair: true});
graph.addLink("liftB","shopB",{weight:10, wheelchair: true});
graph.addLink("shopA","stairsA",{weight:5, wheelchair: true});
graph.addLink("stairsA","stairsB",{weight:1, wheelchair: false});
graph.addLink("stairsB","shopB",{weight:5, wheelchair: true});

let pathFinder_wc = ngraphPath.aStar(graph, {
    blocked(fromNode, toNode, link) {
        return !link.data.wheelchair;
    },
    distance(fromNode, toNode, link) {
        return link.data.weight;
    },
});

let path = pathFinder_wc.find("shopA","shopB");

path always returns the shortest regardless of stairsA -> stairsB is wheelchair false

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions