You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Claudio Squarcella (Updated) (JIRA)" <ji...@apache.org> on 2012/01/20 18:05:39 UTC
[jira] [Updated] (SANDBOX-358) Early return/termination for graph
visit
[ https://issues.apache.org/jira/browse/SANDBOX-358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claudio Squarcella updated SANDBOX-358:
---------------------------------------
Attachment: EarlyTerminationAndSubgraphSkipForSearchAlgorithms.patch
Hi,
so I actually changed signatures for methods in {{GraphVisitHandler}}:
* {{discoverVertex}} and {{discoverEdge}} now tell the algorithm if the corresponding {{Vertex}} and {{Edge}} should be expanded (i.e. if their neighbors should be added to the visit queue);
* {{finishVertex}} and {{finishEdge}} tell if the algorithm can be ended prematurely (because the search is complete, e.g. before the target element was found).
All tests still work. I hope you guys like this one :)
Claudio
> 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
> Labels: graph, visit, visithandler
> Attachments: EarlyTerminationAndSubgraphSkipForSearchAlgorithms.patch
>
> Original Estimate: 72h
> Remaining Estimate: 72h
>
> 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