Skip to content
This repository has been archived by the owner on Mar 11, 2020. It is now read-only.

Path search with cost function #24

Closed
wants to merge 19 commits into from

Conversation

mgttlinger
Copy link
Contributor

Functionality for finding the cheapest path between two nodes according to a cost function that sees both nodes and edge labels.

Copy link
Contributor

@rossabaker rossabaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. This seems mostly reasonable to me. I raised a couple questions, but I'm also not the most experienced user of this library, so I'm open to being called a fool. :)

* Cheapest path from vertex `s` to vertex `t` under the cost function `costFkt` with labels
* @group bfs
*/
def cheapestPath[C](s: N, t: N, costFkt: (LNode[N,A],B,LNode[N,A]) => C)(implicit num: Numeric[C]): Option[LPath[N,B]] = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a little more generic as C: Monoid: Order. I imagine C would usually be numeric in the real world, but it doesn't have to be.

*/
def cheapestPath[C](s: N, t: N, costFkt: (LNode[N,A],B,LNode[N,A]) => C)(implicit num: Numeric[C]): Option[LPath[N,B]] = {
require(contains(s))
require(contains(t))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we return None here, or is it important to distinguish a missing vertex from an empty searchtree? The exceptions make me a bit uncomfortable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, ideally we don't throw exceptions but instead codify things into the type system :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rewrite all of this in idris and I will happily encode that in the signature :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, until someone publishes quividris, my question remains. :) Would a None be an acceptable result, or do we need a third value to return?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for not answering this sooner. I think that would be perfectly fine.

adelbertc and others added 3 commits September 17, 2017 15:52
- Redecoration includes the focus of the decomposition when acting on
the rest of the graph
- Fix GDecomp generator so incorrect instances cannot be built (this
should probably be a smart constructor)
Copy link
Contributor

@rossabaker rossabaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks

@rossabaker
Copy link
Contributor

Uh-oh. This doesn't compile together with the changes to LPath in #23. Is one more urgent to you than the other, or do you want to fix them up so they can both go?

#23 and #26 are breaking changes. I'm planning to open a quiver6 branch so we only bump the major version once with our automated release process. We can target that with whatever comes of your open PRs and get a release cut before the cats port.

@rossabaker rossabaker mentioned this pull request Sep 25, 2017
3 tasks
@mgttlinger
Copy link
Contributor Author

I can fix this tomorrow. Ideally the LPath stuff would be merged by then. If not, I'll cherry pick it into this branch as well.

@rossabaker rossabaker mentioned this pull request Sep 25, 2017
@rossabaker
Copy link
Contributor

Great. I'll merge #23 into the quiver-6 branch now, and you can target that branch with your fixed up version of this, and we'll be ready to release.

@mgttlinger
Copy link
Contributor Author

Closing because now targeting quiver-6 in #28

@mgttlinger mgttlinger closed this Sep 26, 2017
@mgttlinger mgttlinger deleted the path-with-costfkt branch September 26, 2017 18:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants