Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds oriented version of getLink and allow people to set default orientatidness #24

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

FelixMo42
Copy link
Contributor

I added an oriented param to getLink so that you can get links pointing either direction easier and makes it easier to see if two links are connected in either direction. Even if they are connected in both direction it will only return one.

Allow people to set the default oriented parameter for using getLink and forEachLinkedNode by doing createGraph({oriented: true}).

I made some unit-testing for it.

@anvaka
Copy link
Owner

anvaka commented Nov 12, 2019

There is an option in forEachLinkedNode() method, which allows to do oriented/non oriented traversal. Does it work for your use case?

By default getLink is oriented, and I'm somewhat reluctant to extend its API without proper use case. Very often this method lies on a hot path, and adding a few more arguments/checks while seem innocent on the surface may cause higher price for CPU intensive algorithms. If there is a general need for getting non-oriented link via getLink we can discuss it, and it seem to be well suited for the scope of #13

What do you think?

@FelixMo42
Copy link
Contributor Author

Currently, there is no fast way to figure out if to nodes are connected in either direction. You have to call hasLink(from, to) and hasLink(to, from).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants