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

Added Edge() getter function #73

Closed
wants to merge 4 commits into from
Closed

Conversation

denk0403
Copy link
Contributor

@denk0403 denk0403 commented Apr 7, 2023

The cgraph package does not currently expose a Graph method for retrieving named edges without automatically creating one. So this PR simply adds a new method Edge(name string, start *Node, end *Node) with such functionality. Its implementation is heavily based on its node counterpart, Node(name string).

Additionally, in an effort to help improve this package's documentation, I added documentation only to the relevant methods.

@constraintAutomaton
Copy link

constraintAutomaton commented Apr 8, 2023

It's really cool, that documentation have been added for those methods, it's a bit annoying that a lot of functions of that package have no documentation I've made an issue about it #74 .

@denk0403 denk0403 marked this pull request as ready for review April 8, 2023 10:41
@goccy
Copy link
Owner

goccy commented Dec 13, 2023

@denk0403 Thank you regarding the addition of documentation !

Regarding the Edge API, the name argument is fine, but I think it is difficult to use if start and end nodes are required. What is the actual use case ? (i.e., I am thinking that in cases where start and end can be specified, it may already be possible to retrieve the edge as well )

@goccy goccy added the reviewed label Dec 13, 2023
@denk0403
Copy link
Contributor Author

I am thinking that in cases where start and end can be specified, it may already be possible to retrieve the edge as well

@goccy Perhaps I missed it, but I didn't see an existing method for retrieving edges without creating one if it doesn't exist. So, a potential use case could be for querying if an edge of a known name exists between two nodes. It may be possible to implement this without requiring the start and end nodes, but my other goal was to continue to mirror the C API, which does require the nodes alongside the edge name.

@goccy
Copy link
Owner

goccy commented Oct 17, 2024

Thank you for your contribution !! I've already added EdgeByName and EdgeByID functions to get edge without creation.

@goccy goccy closed this Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants