001    // GraphLab Project: http://graphlab.sharif.edu
002    // Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology
003    // Distributed under the terms of the GNU Lesser General Public License (LGPL): http://www.gnu.org/licenses/
004    
005    /*
006    * PostWorkHandler.java
007    *
008    * Created on November 15, 2004, 3:11 AM
009    */
010    
011    package graphlab.library.event.handlers;
012    
013    import graphlab.library.BaseVertex;
014    
015    /**
016     * Handles postwork used by algorithms such as BFS.
017     * Depending on the application, the user can define custom classes that
018     * implements PostWorkHandler and pass them to algorithms.
019     *
020     * @author Omid Aladini
021     */
022    public interface PostWorkHandler<VertexType extends BaseVertex> {
023        /**
024         * Does postwork when traversing back from w to v.
025         *
026         * @param returnFrom Id of the vertex traversing back from.
027         * @param returnTo   Id of the vertex traversing back to.
028         * @return whether the traversal should stop at this point.
029         */
030        public boolean doPostWork(VertexType returnFrom, VertexType returnTo);
031    }