GetNearest from "Node To Node" instead of "Position To Node"


Hi guys!

I just want to know if the API (for a PointGraph) is capable of getting the nearest node from another node instead of the nearest node from a position.

Sorry for my english, not my primary language.



The nearest node to a node is always that node, which is probably not what you want. So you can make an NNConstraint that specifically excludes that node.

public class NNConstraintExclude : NNConstraint {
    public GraphNode node;
    public override bool Suitable (GraphNode node) {
        return node != this.node && base.Suitable(node);
NNConstraintExclude nn = new NNConstraintExclude();
nn.node = someNode;
var closestOtherNode =, nn).node;


Sorry I was not at my home, I just tested all your stuff, work very well! :smiley:

Thanks mate, awesome support!