Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CFB6BB2B9 for ; Sat, 21 Jan 2012 01:39:02 +0000 (UTC) Received: (qmail 67974 invoked by uid 500); 21 Jan 2012 01:39:02 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 67872 invoked by uid 500); 21 Jan 2012 01:39:01 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 67864 invoked by uid 99); 21 Jan 2012 01:39:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 21 Jan 2012 01:39:01 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 21 Jan 2012 01:39:00 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 2F084158FEC for ; Sat, 21 Jan 2012 01:38:40 +0000 (UTC) Date: Sat, 21 Jan 2012 01:38:40 +0000 (UTC) From: "Claudio Squarcella (Issue Comment Edited) (JIRA)" To: issues@commons.apache.org Message-ID: <398975535.62471.1327109920194.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1034871144.58234.1327014820444.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Issue Comment Edited] (SANDBOX-358) Early return/termination for graph visit MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/SANDBOX-358?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13189906#comment-13189906 ] Claudio Squarcella edited comment on SANDBOX-358 at 1/21/12 1:37 AM: --------------------------------------------------------------------- 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. the target element was found). All tests still work. I hope you guys like this one :) Claudio was (Author: claudio.squarcella): 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 > Assignee: Simone Tripodi > 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