Skip to content

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