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    package graphlab.library.algorithms.goperators.product;
006    
007    import graphlab.library.BaseVertex;
008    
009    /**
010     * @author Mohammad Ali Rostami
011     * @email ma.rostami@yahoo.com
012     */
013    
014    public class GCartesianProduct extends GProduct {
015        public boolean compare(BaseVertex v1OfFirstG, BaseVertex v2OfFirstG, BaseVertex v1OfSecondG, BaseVertex v2OfSecondG) {
016            return (v1OfFirstG == v2OfFirstG
017                    && g2.isEdge(v1OfSecondG, v2OfSecondG))
018                    || (v1OfSecondG == v2OfSecondG
019                    && g1.isEdge(v1OfFirstG, v2OfFirstG));
020        }
021    }