Skip to content

Feature idea: Add weighting to graph nodes #3

@bgrins

Description

@bgrins

Any interest in this feature? Basically, you can have a graph with different weights on locations. This would factor into the distance cost of a particular path and change the recommended path.

How what would the desired way to represent cost in the function call be?
Currently (1 is inaccessible, 0 is open):

var graph = new Graph([ [0,0,0,0], [1,0,0,1], [1,1,0,0] ]); 

Proposed (anything 0 is inaccessible, anything > 0 is a fixed cost based on the value - so a 2 node would simply add 2 onto the distance instead of 1):

var graph = new Graph([ [0,0,0,0], [1,0,0,2], [1,3.5,0,0] ]); 

Obviously this would break compatibility with the old implementation (since the meaning of walls change), but that could be documented for people updating.

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