go-graphviz
go-graphviz copied to clipboard
Added `Edge()` getter function
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.
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 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 )
I am thinking that in cases where
startandendcan be specified, it may already be possible to retrieve theedgeas 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.