hash-graph icon indicating copy to clipboard operation
hash-graph copied to clipboard

Currency exchange example

Open patrickdoc opened this issue 8 years ago • 1 comments

From Reddit:

Does this support finding all possible paths between two specific nodes, where each edge is represented by a Money.ExchangeRate src dst? I.e. can I use arbitrary types for defining edges and nodes?

I want to use an ExchangeRate src dst to represent a path from src to dst, but fgl forces me to reduce all nodes to an Int, which means I lose a lot of information, and it becomes non-obvious to me how to restore this if I use pathTree for finding paths (which returns just [Int]).

It's not really about type-level vs. value-level, though. So if it works for SomeExchangeRate that's more than fine, too.

This example is precisely the kind of thing that should benefit from hashing for information preservation.

Consider arbitrary edge types.

patrickdoc avatar Jan 25 '18 19:01 patrickdoc

Thanks for picking this up! Below is the above description with formatting (and links) intact. I will create a separate issue for adding a pathTree-variant to Data.HashGraph.Algorithms.

Does this support finding all possible paths between two specific nodes, where each edge is represented by a Money.ExchangeRate src dst? I.e. can I use arbitrary types for defining edges and nodes?

I want to use an ExchangeRate src dst to represent a path from src to dst, but fgl forces me to reduce all nodes to an Int, which means I lose a lot of information, and it becomes non-obvious to me how to restore this if I use pathTree for finding paths (which returns just [Int]).

It's not really about type-level vs. value-level, though. So if it works for SomeExchangeRate that's more than fine, too.

runeksvendsen avatar Jan 26 '18 13:01 runeksvendsen