Skip to content

Get a successor node from source with a specific label #113

@kavuri

Description

@kavuri

I know there is no way to retrieve a node given an edge label, but I am constantly hitting a use case of trying to get a successor node with a given label. Consider a graph representation like:

g.setNode("1", "foo");
g.setNode("2", "bar");
g.setNode("3", "xyz");
g.setNode("4", "pqr");
g.setEdge("1", "2", {label:"time"});
g.setEdge("1", "3", {label: "space"});
g.setEdge("1", "4", {label":"cont"});

I was thinking of something like,
const c = g.getSuccessor("1", {label:"time"}); // returns "2"

The signature would be something like g.getSuccessor(<nodeName>, <edgeLabel>)

I understand that the edges are unique, but maybe leave it to the API user? Is this something that is possible?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions