You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inspired by pathfinding crate, it would be nice to have a possibility to specify a structure of an implicit graph just by providing a function to get the neighbors of a vertex. Currently, it is necessary to implement several traits (Neighbors and *Weak traits).
There could be a struct Implicit that would be a wrapper over a generic F that would represent a function implementing the Neighbors::neighbors_directed. The rest of Neighbors trait plus all *Weak traits would be implemented by the wrapper.
The implementation of Neighbors::neighbors will be probably a bit tricky, it needs to correctly handle undirected and directed graphs. And the type of Neighbors::NeighborsIter will need to be something like Box<dyn Iterator> so that the implementation of Neighbors::neighbors can chain outgoing and incoming edges.
The text was updated successfully, but these errors were encountered:
And alternative or complement might be to implement all the mentioned traits for any appropriate F: Fn(...) -> ..., so that a function or closure could be sent directly in place of graph G.
Inspired by pathfinding crate, it would be nice to have a possibility to specify a structure of an implicit graph just by providing a function to get the neighbors of a vertex. Currently, it is necessary to implement several traits (
Neighbors
and*Weak
traits).There could be a struct
Implicit
that would be a wrapper over a genericF
that would represent a function implementing theNeighbors::neighbors_directed
. The rest ofNeighbors
trait plus all*Weak
traits would be implemented by the wrapper.The implementation of
Neighbors::neighbors
will be probably a bit tricky, it needs to correctly handle undirected and directed graphs. And the type ofNeighbors::NeighborsIter
will need to be something likeBox<dyn Iterator>
so that the implementation ofNeighbors::neighbors
can chain outgoing and incoming edges.The text was updated successfully, but these errors were encountered: