Replace 2nd parameter of callback functions by a traversal attribute? #11
Replies: 5 comments 2 replies
-
Pro: With just one parameter, the callback functions would be more intuitive |
Beta Was this translation helpful? Give feedback.
-
Pro: The second parameter disturbs caching, e.g. with @functools.cache |
Beta Was this translation helpful? Give feedback.
-
Contra: It is intuitive to get some state, that is valid when the callback happens, as parameter of the callback function. It is less intuitive to get it from a special attribute of the traversal object that represents the state of the traversal when results are reported. |
Beta Was this translation helpful? Give feedback.
-
Contra: Future extensions of NoGraphs with features of parallelism are easier to handle with the current approach of a parameter, because then, several states 'when the callback happens' can occur in parallel. |
Beta Was this translation helpful? Give feedback.
-
Can user attach his own data to it? |
Beta Was this translation helpful? Give feedback.
-
Currently, each NextVertices and NextEdges function needs to have a second parameter to receive the current traversal state from NoGraphs when the callback function is called by NoGraphs to get the next vertices or edges for a vertex. But is is needed only for search-aware graphs, a special case.
NoGraphs could also provide access to the state 'at the time of the callback' by some attribute, instead of the parameter.
Beta Was this translation helpful? Give feedback.
All reactions