Early return/termination for graph visit
----------------------------------------

                 Key: SANDBOX-358
                 URL: https://issues.apache.org/jira/browse/SANDBOX-358
             Project: Commons Sandbox
          Issue Type: Improvement
          Components: Graph
            Reporter: Claudio Squarcella
            Priority: Minor


Hello,

the current implementations in the class {{Visit}} (package 
{{org.apache.commons.graph.visit}}) do not include the possibility to stop the 
search prematurely. That would be more natural (and faster) for many kinds of 
search, e.g. when looking for the first occurrence of a specific pattern 
(vertex, path with certain features, etc).

The easiest solution: changing all method signatures in {{GraphVisitHandler}} 
from {{void}} to {{boolean}}, forcing the handler to answer the question: 
_should I continue?_ 

I understand semantics get a bit entangled (well, not with an appropriate 
documentation!), so I am open to more verbose options: e.g. a method 
{{isSearchComplete}} to call after every step... but that would only be more 
verbose, wouldn't it?

Waiting for feedback and ready to patch :-)
Claudio

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to