├── Datasets ├── test2.lg └── test1.lg ├── GRAMI_DIRECTED_PATTERNS └── src │ ├── dataStructures │ ├── Cloneable.java │ ├── Frequented.java │ ├── Canonizable.java │ ├── serializableObject.java │ ├── Generic.java │ ├── IntIterator.java │ ├── Extension.java │ ├── gEdgeComparator.java │ ├── freqComparator.java │ ├── Frequency.java │ ├── ConnectedComponent.java │ ├── DFScodeSerializer.java │ ├── Query.java │ └── Node.java │ ├── search │ ├── Generic.java │ ├── Strategy.java │ ├── Extender.java │ ├── CanonicalPruningStep.java │ ├── EmbeddingBasedGenerationStep.java │ ├── GenerationPartialStep.java │ └── FrequencyPruningStep.java │ ├── Dijkstra │ ├── RoutesMap.java │ └── DenseRoutesMap.java │ ├── utilities │ ├── DfscodesCache.java │ ├── MyPair.java │ └── Settings.java │ ├── CSP │ ├── VariablePair.java │ ├── VariableCandidates.java │ ├── ConstraintGraph.java │ └── SearchOrder.java │ ├── statistics │ ├── TimedOutSearchStats.java │ └── DistinctLabelStat.java │ ├── AlgorithmInterface │ └── Algorithm.java │ └── temp │ └── Reminder.java ├── GRAMI_DIRECTED_SUBGRAPHS └── src │ ├── dataStructures │ ├── Cloneable.java │ ├── Frequented.java │ ├── Canonizable.java │ ├── serializableObject.java │ ├── Generic.java │ ├── IntIterator.java │ ├── Extension.java │ ├── gEdgeComparator.java │ ├── freqComparator.java │ ├── StaticData.java │ ├── Frequency.java │ ├── ConnectedComponent.java │ ├── DFScodeSerializer.java │ ├── Query.java │ └── Node.java │ ├── search │ ├── Generic.java │ ├── Strategy.java │ ├── Extender.java │ ├── EmbeddingBasedGenerationStep.java │ ├── CanonicalPruningStep.java │ └── FrequencyPruningStep.java │ ├── Dijkstra │ ├── RoutesMap.java │ └── DenseRoutesMap.java │ ├── utilities │ ├── DfscodesCache.java │ ├── Settings.java │ └── MyPair.java │ ├── CSP │ ├── VariablePair.java │ ├── VariableCandidates.java │ ├── ConstraintGraph.java │ └── SearchOrder.java │ ├── statistics │ ├── TimedOutSearchStats.java │ └── DistinctLabelStat.java │ ├── temp │ └── Reminder.java │ └── AlgorithmInterface │ └── Algorithm.java ├── GRAMI_UNDIRECTED_PATTERNS └── src │ ├── dataStructures │ ├── Cloneable.java │ ├── Frequented.java │ ├── Canonizable.java │ ├── serializableObject.java │ ├── Generic.java │ ├── IntIterator.java │ ├── Extension.java │ ├── gEdgeComparator.java │ ├── freqComparator.java │ ├── Frequency.java │ ├── ConnectedComponent.java │ ├── DFScodeSerializer.java │ ├── Query.java │ └── Node.java │ ├── search │ ├── Generic.java │ ├── Strategy.java │ ├── Extender.java │ ├── EmbeddingBasedGenerationStep.java │ ├── CanonicalPruningStep.java │ └── FrequencyPruningStep.java │ ├── Dijkstra │ ├── RoutesMap.java │ └── DenseRoutesMap.java │ ├── utilities │ ├── DfscodesCache.java │ ├── Settings.java │ ├── MyPair.java │ └── StopWatch.java │ ├── CSP │ ├── VariablePair.java │ ├── VariableCandidates.java │ ├── ConstraintGraph.java │ └── SearchOrder.java │ ├── temp │ └── Reminder.java │ ├── statistics │ └── DistinctLabelStat.java │ └── AlgorithmInterface │ └── Algorithm.java ├── GRAMI_UNDIRECTED_SUBGRAPHS └── src │ ├── dataStructures │ ├── Cloneable.java │ ├── Frequented.java │ ├── Canonizable.java │ ├── serializableObject.java │ ├── Generic.java │ ├── StaticData.java │ ├── IntIterator.java │ ├── Extension.java │ ├── gEdgeComparator.java │ ├── freqComparator.java │ ├── Frequency.java │ ├── ConnectedComponent.java │ ├── DFScodeSerializer.java │ ├── Query.java │ └── Node.java │ ├── search │ ├── Generic.java │ ├── Strategy.java │ ├── Extender.java │ ├── CanonicalPruningStep.java │ ├── EmbeddingBasedGenerationStep.java │ └── FrequencyPruningStep.java │ ├── Dijkstra │ ├── RoutesMap.java │ └── DenseRoutesMap.java │ ├── utilities │ ├── DfscodesCache.java │ ├── Settings.java │ └── MyPair.java │ ├── CSP │ ├── VariableCandidates.java │ ├── VariablePair.java │ ├── ConstraintGraph.java │ └── SearchOrder.java │ ├── statistics │ ├── TimedOutSearchStats.java │ └── DistinctLabelStat.java │ ├── temp │ └── Reminder.java │ └── AlgorithmInterface │ └── Algorithm.java ├── Output.txt └── README.md /Datasets/test2.lg: -------------------------------------------------------------------------------- 1 | # t 1 2 | v 0 1 3 | v 1 2 4 | v 2 3 5 | v 3 1 6 | v 4 2 7 | v 5 3 8 | v 6 1 9 | v 7 2 10 | v 8 3 11 | v 9 1 12 | v 10 2 13 | v 11 3 14 | e 0 1 5 15 | e 1 2 6 16 | e 3 4 5 17 | e 4 5 6 18 | e 6 7 5 19 | e 7 8 6 20 | e 8 9 5 21 | e 9 10 7 22 | e 10 11 8 23 | -------------------------------------------------------------------------------- /Datasets/test1.lg: -------------------------------------------------------------------------------- 1 | # t 1 2 | v 0 1 3 | v 1 3 4 | v 2 2 5 | v 3 2 6 | v 4 3 7 | v 5 1 8 | v 6 2 9 | v 7 3 10 | v 8 1 11 | v 9 3 12 | v 10 2 13 | v 11 1 14 | e 0 1 1 15 | e 1 2 1 16 | e 2 0 1 17 | e 1 3 1 18 | e 3 4 1 19 | e 3 5 1 20 | e 4 5 1 21 | e 6 7 1 22 | e 7 8 1 23 | e 6 8 1 24 | e 9 10 1 25 | e 10 11 1 26 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/dataStructures/Cloneable.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 19, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | /** 18 | * This interface allows cloneing objects of the implementing type 19 | * 20 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 21 | * 22 | * @param 23 | * the type that should be cloned 24 | */ 25 | public interface Cloneable { 26 | 27 | public T clone(); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/dataStructures/Cloneable.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 19, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | /** 18 | * This interface allows cloneing objects of the implementing type 19 | * 20 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 21 | * 22 | * @param 23 | * the type that should be cloned 24 | */ 25 | public interface Cloneable { 26 | 27 | public T clone(); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/dataStructures/Cloneable.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 19, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | /** 18 | * This interface allows cloneing objects of the implementing type 19 | * 20 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 21 | * 22 | * @param 23 | * the type that should be cloned 24 | */ 25 | public interface Cloneable { 26 | 27 | public T clone(); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/dataStructures/Cloneable.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 19, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | /** 18 | * This interface allows cloneing objects of the implementing type 19 | * 20 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 21 | * 22 | * @param 23 | * the type that should be cloned 24 | */ 25 | public interface Cloneable { 26 | 27 | public T clone(); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/dataStructures/Frequented.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 25, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | import java.io.Serializable; 18 | 19 | /** 20 | * This interface encapsulates the posability to be frequented 21 | * 22 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 23 | * 24 | */ 25 | public interface Frequented extends Serializable{ 26 | 27 | /** @return the attached frequency */ 28 | public Frequency frequency(); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/dataStructures/Frequented.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 25, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | import java.io.Serializable; 18 | 19 | /** 20 | * This interface encapsulates the posability to be frequented 21 | * 22 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 23 | * 24 | */ 25 | public interface Frequented extends Serializable{ 26 | 27 | /** @return the attached frequency */ 28 | public Frequency frequency(); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/dataStructures/Frequented.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 25, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | import java.io.Serializable; 18 | 19 | /** 20 | * This interface encapsulates the posability to be frequented 21 | * 22 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 23 | * 24 | */ 25 | public interface Frequented extends Serializable{ 26 | 27 | /** @return the attached frequency */ 28 | public Frequency frequency(); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/dataStructures/Frequented.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 25, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | import java.io.Serializable; 18 | 19 | /** 20 | * This interface encapsulates the posability to be frequented 21 | * 22 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 23 | * 24 | */ 25 | public interface Frequented extends Serializable{ 26 | 27 | /** @return the attached frequency */ 28 | public Frequency frequency(); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/dataStructures/Canonizable.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 16, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | /** 18 | * This interface encapsulate the required abilities of canonizable objects. 19 | * 20 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 21 | * 22 | */ 23 | public interface Canonizable { 24 | 25 | /** 26 | * @return true, if the current object is a canonical 27 | * representation 28 | */ 29 | public boolean isCanonical(); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/dataStructures/Canonizable.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 16, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | /** 18 | * This interface encapsulate the required abilities of canonizable objects. 19 | * 20 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 21 | * 22 | */ 23 | public interface Canonizable { 24 | 25 | /** 26 | * @return true, if the current object is a canonical 27 | * representation 28 | */ 29 | public boolean isCanonical(); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/dataStructures/Canonizable.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 16, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | /** 18 | * This interface encapsulate the required abilities of canonizable objects. 19 | * 20 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 21 | * 22 | */ 23 | public interface Canonizable { 24 | 25 | /** 26 | * @return true, if the current object is a canonical 27 | * representation 28 | */ 29 | public boolean isCanonical(); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/dataStructures/Canonizable.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 16, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | /** 18 | * This interface encapsulate the required abilities of canonizable objects. 19 | * 20 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 21 | * 22 | */ 23 | public interface Canonizable { 24 | 25 | /** 26 | * @return true, if the current object is a canonical 27 | * representation 28 | */ 29 | public boolean isCanonical(); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/dataStructures/serializableObject.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package dataStructures; 21 | 22 | import java.io.Serializable; 23 | 24 | public interface serializableObject extends Serializable{ 25 | 26 | } 27 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/dataStructures/serializableObject.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package dataStructures; 21 | 22 | import java.io.Serializable; 23 | 24 | public interface serializableObject extends Serializable{ 25 | 26 | } 27 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/dataStructures/serializableObject.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package dataStructures; 21 | 22 | import java.io.Serializable; 23 | 24 | public interface serializableObject extends Serializable{ 25 | 26 | } 27 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/dataStructures/serializableObject.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package dataStructures; 21 | 22 | import java.io.Serializable; 23 | 24 | public interface serializableObject extends Serializable{ 25 | 26 | } 27 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/search/Generic.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 19, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package search; 16 | 17 | /** 18 | * This interface if for statically determin the generic classes 19 | * 20 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 21 | * 22 | * @param 23 | * the type of the node labels (will be hashed and checked with 24 | * .equals(..)) 25 | * @param 26 | * the type of the edge labels (will be hashed and checked with 27 | * .equals(..)) 28 | */ 29 | public interface Generic { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/search/Generic.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 19, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package search; 16 | 17 | /** 18 | * This interface if for statically determin the generic classes 19 | * 20 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 21 | * 22 | * @param 23 | * the type of the node labels (will be hashed and checked with 24 | * .equals(..)) 25 | * @param 26 | * the type of the edge labels (will be hashed and checked with 27 | * .equals(..)) 28 | */ 29 | public interface Generic { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/search/Generic.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 19, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package search; 16 | 17 | /** 18 | * This interface if for statically determin the generic classes 19 | * 20 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 21 | * 22 | * @param 23 | * the type of the node labels (will be hashed and checked with 24 | * .equals(..)) 25 | * @param 26 | * the type of the edge labels (will be hashed and checked with 27 | * .equals(..)) 28 | */ 29 | public interface Generic { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/search/Generic.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 19, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package search; 16 | 17 | /** 18 | * This interface if for statically determin the generic classes 19 | * 20 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 21 | * 22 | * @param 23 | * the type of the node labels (will be hashed and checked with 24 | * .equals(..)) 25 | * @param 26 | * the type of the edge labels (will be hashed and checked with 27 | * .equals(..)) 28 | */ 29 | public interface Generic { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/dataStructures/Generic.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 19, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | /** 18 | * This interface if for statically determin the generic classes 19 | * 20 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 21 | * 22 | * @param 23 | * the type of the node labels (will be hashed and checked with 24 | * .equals(..)) 25 | * @param 26 | * the type of the edge labels (will be hashed and checked with 27 | * .equals(..)) 28 | */ 29 | public interface Generic { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/dataStructures/Generic.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 19, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | /** 18 | * This interface if for statically determin the generic classes 19 | * 20 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 21 | * 22 | * @param 23 | * the type of the node labels (will be hashed and checked with 24 | * .equals(..)) 25 | * @param 26 | * the type of the edge labels (will be hashed and checked with 27 | * .equals(..)) 28 | */ 29 | public interface Generic { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/dataStructures/Generic.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 19, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | /** 18 | * This interface if for statically determin the generic classes 19 | * 20 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 21 | * 22 | * @param 23 | * the type of the node labels (will be hashed and checked with 24 | * .equals(..)) 25 | * @param 26 | * the type of the edge labels (will be hashed and checked with 27 | * .equals(..)) 28 | */ 29 | public interface Generic { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/dataStructures/Generic.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 19, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | /** 18 | * This interface if for statically determin the generic classes 19 | * 20 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 21 | * 22 | * @param 23 | * the type of the node labels (will be hashed and checked with 24 | * .equals(..)) 25 | * @param 26 | * the type of the edge labels (will be hashed and checked with 27 | * .equals(..)) 28 | */ 29 | public interface Generic { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/dataStructures/StaticData.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package dataStructures; 21 | 22 | import java.util.HashMap; 23 | 24 | public class StaticData 25 | { 26 | public static HashMap[]> hashedEdges; 27 | public static int counter = 0; 28 | } 29 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/Dijkstra/RoutesMap.java: -------------------------------------------------------------------------------- 1 | package Dijkstra; 2 | 3 | 4 | import java.util.List; 5 | 6 | /** 7 | * This interface defines the object storing the graph of all routes in the 8 | * system. 9 | * 10 | * @author Renaud Waldura <renaud+tw@waldura.com> 11 | * @version $Id: RoutesMap.java 2367 2007-08-20 21:47:25Z renaud $ 12 | */ 13 | 14 | public interface RoutesMap 15 | { 16 | /** 17 | * Enter a new segment in the graph. 18 | */ 19 | public void addDirectRoute(int start, int end, int distance); 20 | 21 | /** 22 | * Get the value of a segment. 23 | */ 24 | public double getDistance(int start, int end); 25 | 26 | /** 27 | * Get the list of cities that can be reached from the given city. 28 | */ 29 | public List getDestinations(int city); 30 | 31 | /** 32 | * Get the list of cities that lead to the given city. 33 | */ 34 | //public List getPredecessors(City city); 35 | 36 | /** 37 | * @return the transposed graph of this graph, as a new RoutesMap instance. 38 | */ 39 | //public RoutesMap getInverse(); 40 | } 41 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/dataStructures/IntIterator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 30, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | /** 18 | * This interface represents an iterator over a set of integers 19 | * 20 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 21 | * 22 | */ 23 | public interface IntIterator { 24 | 25 | /** @return true if the iteration has more elements. */ 26 | public boolean hasNext(); 27 | 28 | /** @return the next element in the iteration */ 29 | public int next(); 30 | 31 | /** 32 | * Removes from the underlying source the last element returned by the 33 | * iterator (optional operation). 34 | */ 35 | public void remove(); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/Dijkstra/RoutesMap.java: -------------------------------------------------------------------------------- 1 | package Dijkstra; 2 | 3 | 4 | import java.util.List; 5 | 6 | /** 7 | * This interface defines the object storing the graph of all routes in the 8 | * system. 9 | * 10 | * @author Renaud Waldura <renaud+tw@waldura.com> 11 | * @version $Id: RoutesMap.java 2367 2007-08-20 21:47:25Z renaud $ 12 | */ 13 | 14 | public interface RoutesMap 15 | { 16 | /** 17 | * Enter a new segment in the graph. 18 | */ 19 | public void addDirectRoute(int start, int end, int distance); 20 | 21 | /** 22 | * Get the value of a segment. 23 | */ 24 | public double getDistance(int start, int end); 25 | 26 | /** 27 | * Get the list of cities that can be reached from the given city. 28 | */ 29 | public List getDestinations(int city); 30 | 31 | /** 32 | * Get the list of cities that lead to the given city. 33 | */ 34 | //public List getPredecessors(City city); 35 | 36 | /** 37 | * @return the transposed graph of this graph, as a new RoutesMap instance. 38 | */ 39 | //public RoutesMap getInverse(); 40 | } 41 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/dataStructures/IntIterator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 30, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | /** 18 | * This interface represents an iterator over a set of integers 19 | * 20 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 21 | * 22 | */ 23 | public interface IntIterator { 24 | 25 | /** @return true if the iteration has more elements. */ 26 | public boolean hasNext(); 27 | 28 | /** @return the next element in the iteration */ 29 | public int next(); 30 | 31 | /** 32 | * Removes from the underlying source the last element returned by the 33 | * iterator (optional operation). 34 | */ 35 | public void remove(); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/Dijkstra/RoutesMap.java: -------------------------------------------------------------------------------- 1 | package Dijkstra; 2 | 3 | 4 | import java.util.List; 5 | 6 | /** 7 | * This interface defines the object storing the graph of all routes in the 8 | * system. 9 | * 10 | * @author Renaud Waldura <renaud+tw@waldura.com> 11 | * @version $Id: RoutesMap.java 2367 2007-08-20 21:47:25Z renaud $ 12 | */ 13 | 14 | public interface RoutesMap 15 | { 16 | /** 17 | * Enter a new segment in the graph. 18 | */ 19 | public void addDirectRoute(int start, int end, int distance); 20 | 21 | /** 22 | * Get the value of a segment. 23 | */ 24 | public double getDistance(int start, int end); 25 | 26 | /** 27 | * Get the list of cities that can be reached from the given city. 28 | */ 29 | public List getDestinations(int city); 30 | 31 | /** 32 | * Get the list of cities that lead to the given city. 33 | */ 34 | //public List getPredecessors(City city); 35 | 36 | /** 37 | * @return the transposed graph of this graph, as a new RoutesMap instance. 38 | */ 39 | //public RoutesMap getInverse(); 40 | } 41 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/dataStructures/IntIterator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 30, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | /** 18 | * This interface represents an iterator over a set of integers 19 | * 20 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 21 | * 22 | */ 23 | public interface IntIterator { 24 | 25 | /** @return true if the iteration has more elements. */ 26 | public boolean hasNext(); 27 | 28 | /** @return the next element in the iteration */ 29 | public int next(); 30 | 31 | /** 32 | * Removes from the underlying source the last element returned by the 33 | * iterator (optional operation). 34 | */ 35 | public void remove(); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/Dijkstra/RoutesMap.java: -------------------------------------------------------------------------------- 1 | package Dijkstra; 2 | 3 | 4 | import java.util.List; 5 | 6 | /** 7 | * This interface defines the object storing the graph of all routes in the 8 | * system. 9 | * 10 | * @author Renaud Waldura <renaud+tw@waldura.com> 11 | * @version $Id: RoutesMap.java 2367 2007-08-20 21:47:25Z renaud $ 12 | */ 13 | 14 | public interface RoutesMap 15 | { 16 | /** 17 | * Enter a new segment in the graph. 18 | */ 19 | public void addDirectRoute(int start, int end, int distance); 20 | 21 | /** 22 | * Get the value of a segment. 23 | */ 24 | public double getDistance(int start, int end); 25 | 26 | /** 27 | * Get the list of cities that can be reached from the given city. 28 | */ 29 | public List getDestinations(int city); 30 | 31 | /** 32 | * Get the list of cities that lead to the given city. 33 | */ 34 | //public List getPredecessors(City city); 35 | 36 | /** 37 | * @return the transposed graph of this graph, as a new RoutesMap instance. 38 | */ 39 | //public RoutesMap getInverse(); 40 | } 41 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/dataStructures/IntIterator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 30, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | /** 18 | * This interface represents an iterator over a set of integers 19 | * 20 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 21 | * 22 | */ 23 | public interface IntIterator { 24 | 25 | /** @return true if the iteration has more elements. */ 26 | public boolean hasNext(); 27 | 28 | /** @return the next element in the iteration */ 29 | public int next(); 30 | 31 | /** 32 | * Removes from the underlying source the last element returned by the 33 | * iterator (optional operation). 34 | */ 35 | public void remove(); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/utilities/DfscodesCache.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package utilities; 21 | 22 | import java.util.HashMap; 23 | import java.util.HashSet; 24 | 25 | public class DfscodesCache 26 | { 27 | public static HashMap>> cache= new HashMap>>(); 28 | } 29 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/dataStructures/Extension.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 16, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | 18 | 19 | /** 20 | * This interface encapsulate the required abilities of a extension of a 21 | * fragment. 22 | * 23 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 24 | * 25 | * @param 26 | * the type of the node labels (will be hashed and checked with 27 | * .equals(..)) 28 | * @param 29 | * the type of the edge labels (will be hashed and checked with 30 | * .equals(..)) 31 | */ 32 | public interface Extension extends 33 | Comparable>, 34 | Frequented { 35 | } 36 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/dataStructures/Extension.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 16, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | 18 | 19 | /** 20 | * This interface encapsulate the required abilities of a extension of a 21 | * fragment. 22 | * 23 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 24 | * 25 | * @param 26 | * the type of the node labels (will be hashed and checked with 27 | * .equals(..)) 28 | * @param 29 | * the type of the edge labels (will be hashed and checked with 30 | * .equals(..)) 31 | */ 32 | public interface Extension extends 33 | Comparable>, 34 | Frequented { 35 | } 36 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/dataStructures/Extension.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 16, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | 18 | 19 | /** 20 | * This interface encapsulate the required abilities of a extension of a 21 | * fragment. 22 | * 23 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 24 | * 25 | * @param 26 | * the type of the node labels (will be hashed and checked with 27 | * .equals(..)) 28 | * @param 29 | * the type of the edge labels (will be hashed and checked with 30 | * .equals(..)) 31 | */ 32 | public interface Extension extends 33 | Comparable>, 34 | Frequented { 35 | } 36 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/dataStructures/Extension.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 16, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | 18 | 19 | /** 20 | * This interface encapsulate the required abilities of a extension of a 21 | * fragment. 22 | * 23 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 24 | * 25 | * @param 26 | * the type of the node labels (will be hashed and checked with 27 | * .equals(..)) 28 | * @param 29 | * the type of the edge labels (will be hashed and checked with 30 | * .equals(..)) 31 | */ 32 | public interface Extension extends 33 | Comparable>, 34 | Frequented { 35 | } 36 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/utilities/DfscodesCache.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package utilities; 21 | 22 | import java.util.HashMap; 23 | import java.util.HashSet; 24 | import java.util.Iterator; 25 | import java.util.Map; 26 | 27 | public class DfscodesCache 28 | { 29 | public static HashMap>> cache= new HashMap>>(); 30 | } 31 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/utilities/DfscodesCache.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package utilities; 21 | 22 | import java.util.HashMap; 23 | import java.util.HashSet; 24 | import java.util.Iterator; 25 | import java.util.Map; 26 | 27 | public class DfscodesCache 28 | { 29 | public static HashMap>> cache= new HashMap>>(); 30 | } 31 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/utilities/DfscodesCache.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package utilities; 21 | 22 | import java.util.HashMap; 23 | import java.util.HashSet; 24 | import java.util.Iterator; 25 | import java.util.Map; 26 | 27 | public class DfscodesCache 28 | { 29 | public static HashMap>> cache= new HashMap>>(); 30 | } 31 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/dataStructures/gEdgeComparator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package dataStructures; 21 | 22 | import java.util.Comparator; 23 | 24 | public class gEdgeComparator implements Comparator { 25 | 26 | public int compare(Object a, Object b) 27 | { 28 | 29 | return ((GSpanEdge)a).compareTo(((GSpanEdge)b)); 30 | 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/dataStructures/gEdgeComparator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package dataStructures; 21 | 22 | import java.util.Comparator; 23 | 24 | public class gEdgeComparator implements Comparator { 25 | 26 | public int compare(Object a, Object b) 27 | { 28 | 29 | return ((GSpanEdge)a).compareTo(((GSpanEdge)b)); 30 | 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/dataStructures/gEdgeComparator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package dataStructures; 21 | 22 | import java.util.Comparator; 23 | 24 | public class gEdgeComparator implements Comparator { 25 | 26 | public int compare(Object a, Object b) 27 | { 28 | 29 | return ((GSpanEdge)a).compareTo(((GSpanEdge)b)); 30 | 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/dataStructures/gEdgeComparator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package dataStructures; 21 | 22 | import java.util.Comparator; 23 | 24 | public class gEdgeComparator implements Comparator { 25 | 26 | public int compare(Object a, Object b) 27 | { 28 | 29 | return ((GSpanEdge)a).compareTo(((GSpanEdge)b)); 30 | 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/dataStructures/freqComparator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package dataStructures; 21 | 22 | import java.awt.Point; 23 | import java.util.Comparator; 24 | 25 | public class freqComparator implements Comparator { 26 | 27 | public int compare(Point o1, Point o2) { 28 | 29 | if(o1.y>o2.y) 30 | return -1; 31 | else if(o1.y. 18 | */ 19 | 20 | package dataStructures; 21 | 22 | import java.awt.Point; 23 | import java.util.Comparator; 24 | 25 | public class freqComparator implements Comparator { 26 | 27 | public int compare(Point o1, Point o2) { 28 | 29 | if(o1.y>o2.y) 30 | return -1; 31 | else if(o1.y. 18 | */ 19 | 20 | package dataStructures; 21 | 22 | import java.awt.Point; 23 | import java.util.Comparator; 24 | 25 | public class freqComparator implements Comparator { 26 | 27 | public int compare(Point o1, Point o2) { 28 | 29 | if(o1.y>o2.y) 30 | return -1; 31 | else if(o1.y. 18 | */ 19 | 20 | package dataStructures; 21 | 22 | import java.awt.Point; 23 | import java.util.Comparator; 24 | 25 | public class freqComparator implements Comparator { 26 | 27 | public int compare(Point o1, Point o2) { 28 | 29 | if(o1.y>o2.y) 30 | return -1; 31 | else if(o1.y. 18 | */ 19 | 20 | package dataStructures; 21 | 22 | import java.util.HashMap; 23 | 24 | public class StaticData { 25 | 26 | public static HashMap[]> hashedEdges; 27 | public static int getHashedEdgesFreq(String sig) 28 | { 29 | HashMap[] hm = hashedEdges.get(sig); 30 | if(hm==null) 31 | return 0; 32 | int freq = hm[0].size(); 33 | if(freq>hm[1].size()) 34 | return hm[1].size(); 35 | return freq; 36 | } 37 | public static int counter = 0; 38 | } 39 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/CSP/VariablePair.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package CSP; 21 | 22 | public class VariablePair 23 | { 24 | public Variable v1; 25 | public Variable v2; 26 | public VariablePair(Variable v1,Variable v2) 27 | { 28 | this.v1=v1; 29 | this.v2=v2; 30 | } 31 | 32 | public String getString() 33 | { 34 | String x = v1.getID()+"-"+v2.getID(); 35 | return x; 36 | } 37 | 38 | public int getMinValuesLength() 39 | { 40 | if(v1.getListSize(). 18 | */ 19 | 20 | package CSP; 21 | 22 | public class VariablePair 23 | { 24 | public Variable v1; 25 | public Variable v2; 26 | public VariablePair(Variable v1,Variable v2) 27 | { 28 | this.v1=v1; 29 | this.v2=v2; 30 | } 31 | 32 | public String getString() 33 | { 34 | String x = v1.getID()+"-"+v2.getID(); 35 | return x; 36 | } 37 | 38 | public int getMinValuesLength() 39 | { 40 | if(v1.getListSize(). 18 | */ 19 | 20 | package CSP; 21 | 22 | import java.util.ArrayList; 23 | 24 | public class VariableCandidates 25 | { 26 | 27 | private int variableID; 28 | private ArrayList candidates; 29 | 30 | public VariableCandidates(int variableID,ArrayList candidates) 31 | { 32 | this.variableID=variableID; 33 | this.candidates=candidates; 34 | } 35 | 36 | public int getVariableID() { 37 | return variableID; 38 | } 39 | 40 | public ArrayList getCandidates() { 41 | return candidates; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/CSP/VariableCandidates.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package CSP; 21 | 22 | import java.util.ArrayList; 23 | 24 | public class VariableCandidates 25 | { 26 | 27 | private int variableID; 28 | private ArrayList candidates; 29 | 30 | public VariableCandidates(int variableID,ArrayList candidates) 31 | { 32 | this.variableID=variableID; 33 | this.candidates=candidates; 34 | } 35 | 36 | public int getVariableID() { 37 | return variableID; 38 | } 39 | 40 | public ArrayList getCandidates() { 41 | return candidates; 42 | } 43 | 44 | 45 | } 46 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/dataStructures/Frequency.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 15, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | import java.io.Serializable; 18 | 19 | /** 20 | * This interface describes the functionality of a frequency for graph mining 21 | * 22 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 23 | * 24 | */ 25 | public interface Frequency extends Comparable, Serializable { 26 | 27 | /** 28 | * increases this frequency by the given amount 29 | * 30 | * @param freq 31 | */ 32 | public void add(Frequency freq); 33 | 34 | /** 35 | * @return a clone of the Frequency 36 | */ 37 | public Frequency clone(); 38 | 39 | /** 40 | * (skalar) multiplies the frequency with the given factor 41 | * 42 | * @param fac 43 | */ 44 | public void smul(float fac); 45 | 46 | /** 47 | * decreases this frequency by the given amount 48 | * 49 | * @param freq 50 | */ 51 | public void sub(Frequency freq); 52 | 53 | } 54 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/dataStructures/Frequency.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 15, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | import java.io.Serializable; 18 | 19 | /** 20 | * This interface describes the functionality of a frequency for graph mining 21 | * 22 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 23 | * 24 | */ 25 | public interface Frequency extends Comparable, Serializable { 26 | 27 | /** 28 | * increases this frequency by the given amount 29 | * 30 | * @param freq 31 | */ 32 | public void add(Frequency freq); 33 | 34 | /** 35 | * @return a clone of the Frequency 36 | */ 37 | public Frequency clone(); 38 | 39 | /** 40 | * (skalar) multiplies the frequency with the given factor 41 | * 42 | * @param fac 43 | */ 44 | public void smul(float fac); 45 | 46 | /** 47 | * decreases this frequency by the given amount 48 | * 49 | * @param freq 50 | */ 51 | public void sub(Frequency freq); 52 | 53 | } 54 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/dataStructures/Frequency.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 15, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | import java.io.Serializable; 18 | 19 | /** 20 | * This interface describes the functionality of a frequency for graph mining 21 | * 22 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 23 | * 24 | */ 25 | public interface Frequency extends Comparable, Serializable { 26 | 27 | /** 28 | * increases this frequency by the given amount 29 | * 30 | * @param freq 31 | */ 32 | public void add(Frequency freq); 33 | 34 | /** 35 | * @return a clone of the Frequency 36 | */ 37 | public Frequency clone(); 38 | 39 | /** 40 | * (skalar) multiplies the frequency with the given factor 41 | * 42 | * @param fac 43 | */ 44 | public void smul(float fac); 45 | 46 | /** 47 | * decreases this frequency by the given amount 48 | * 49 | * @param freq 50 | */ 51 | public void sub(Frequency freq); 52 | 53 | } 54 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/dataStructures/Frequency.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 15, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | import java.io.Serializable; 18 | 19 | /** 20 | * This interface describes the functionality of a frequency for graph mining 21 | * 22 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 23 | * 24 | */ 25 | public interface Frequency extends Comparable, Serializable { 26 | 27 | /** 28 | * increases this frequency by the given amount 29 | * 30 | * @param freq 31 | */ 32 | public void add(Frequency freq); 33 | 34 | /** 35 | * @return a clone of the Frequency 36 | */ 37 | public Frequency clone(); 38 | 39 | /** 40 | * (skalar) multiplies the frequency with the given factor 41 | * 42 | * @param fac 43 | */ 44 | public void smul(float fac); 45 | 46 | /** 47 | * decreases this frequency by the given amount 48 | * 49 | * @param freq 50 | */ 51 | public void sub(Frequency freq); 52 | 53 | } 54 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/CSP/VariablePair.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package CSP; 21 | 22 | public class VariablePair 23 | { 24 | public Variable v1; 25 | public Variable v2; 26 | public double edgeLabel; 27 | 28 | public VariablePair(Variable v1,Variable v2, double edgeLabel) 29 | { 30 | this.v1=v1; 31 | this.v2=v2; 32 | this.edgeLabel = edgeLabel; 33 | } 34 | 35 | public String getString() 36 | { 37 | String x = v1.getID()+"-"+edgeLabel+"-"+v2.getID(); 38 | return x; 39 | } 40 | 41 | public int getMinValuesLength() 42 | { 43 | if(v1.getListSize(). 18 | */ 19 | 20 | package CSP; 21 | 22 | import java.util.ArrayList; 23 | 24 | import utilities.MyPair; 25 | 26 | public class VariableCandidates 27 | { 28 | 29 | private int variableID; 30 | private ArrayList> candidates; 31 | 32 | public VariableCandidates(int variableID,ArrayList> candidates) 33 | { 34 | this.variableID=variableID; 35 | this.candidates=candidates; 36 | } 37 | 38 | public int getVariableID() { 39 | return variableID; 40 | } 41 | 42 | public ArrayList> getCandidates() { 43 | return candidates; 44 | } 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/CSP/VariableCandidates.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package CSP; 21 | 22 | import java.util.ArrayList; 23 | 24 | import utilities.MyPair; 25 | 26 | public class VariableCandidates 27 | { 28 | 29 | private int variableID; 30 | private ArrayList> candidates; 31 | 32 | public VariableCandidates(int variableID,ArrayList> candidates) 33 | { 34 | this.variableID=variableID; 35 | this.candidates=candidates; 36 | } 37 | 38 | public int getVariableID() { 39 | return variableID; 40 | } 41 | 42 | public ArrayList> getCandidates() { 43 | return candidates; 44 | } 45 | 46 | 47 | } 48 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/statistics/TimedOutSearchStats.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package statistics; 21 | 22 | import java.util.ArrayList; 23 | 24 | import dataStructures.myNode; 25 | 26 | public class TimedOutSearchStats { 27 | public static long totalNumber; 28 | public static long numberOfDomains; 29 | public static long maximum = 0; 30 | 31 | public static long getElementSize() 32 | { 33 | return 56; 34 | } 35 | 36 | public static double getAverage() 37 | { 38 | return totalNumber/numberOfDomains; 39 | } 40 | 41 | public static String getData() 42 | { 43 | return "Total: "+totalNumber+", Domains: "+numberOfDomains+", Average:"+getAverage()+", maximum: "+maximum; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/statistics/TimedOutSearchStats.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package statistics; 21 | 22 | import java.util.ArrayList; 23 | 24 | import dataStructures.myNode; 25 | 26 | public class TimedOutSearchStats { 27 | public static long totalNumber; 28 | public static long numberOfDomains; 29 | public static long maximum = 0; 30 | 31 | public static long getElementSize() 32 | { 33 | return 56; 34 | } 35 | 36 | public static double getAverage() 37 | { 38 | return totalNumber/numberOfDomains; 39 | } 40 | 41 | public static String getData() 42 | { 43 | return "Total: "+totalNumber+", Domains: "+numberOfDomains+", Average:"+getAverage()+", maximum: "+maximum; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/statistics/TimedOutSearchStats.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package statistics; 21 | 22 | import java.util.ArrayList; 23 | 24 | import dataStructures.myNode; 25 | 26 | public class TimedOutSearchStats { 27 | public static long totalNumber; 28 | public static long numberOfDomains; 29 | public static long maximum = 0; 30 | 31 | public static long getElementSize() 32 | { 33 | return 56; 34 | } 35 | 36 | public static double getAverage() 37 | { 38 | return totalNumber/numberOfDomains; 39 | } 40 | 41 | public static String getData() 42 | { 43 | return "Total: "+totalNumber+", Domains: "+numberOfDomains+", Average:"+getAverage()+", maximum: "+maximum; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/search/Strategy.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 16, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package search; 16 | 17 | import java.util.Collection; 18 | 19 | import AlgorithmInterface.Algorithm; 20 | 21 | import dataStructures.HPListGraph; 22 | 23 | 24 | /** 25 | * This interface encapsulates the requirements of a search strategy. 26 | * 27 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 28 | * 29 | * @param 30 | * the type of the node labels (will be hashed and checked with 31 | * .equals(..)) 32 | * @param 33 | * the type of the edge labels (will be hashed and checked with 34 | * .equals(..)) 35 | */ 36 | public interface Strategy extends 37 | Generic { 38 | 39 | /** 40 | * starts the corresponding strategy 41 | * 42 | * @param algo 43 | * the algorithm which search space will be used 44 | * @return the set of found frequent Fragments 45 | */ 46 | public Collection> search( 47 | Algorithm algo,int freqThresh); 48 | 49 | } 50 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/search/Strategy.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 16, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package search; 16 | 17 | import java.util.Collection; 18 | 19 | import AlgorithmInterface.Algorithm; 20 | 21 | import dataStructures.HPListGraph; 22 | 23 | 24 | /** 25 | * This interface encapsulates the requirements of a search strategy. 26 | * 27 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 28 | * 29 | * @param 30 | * the type of the node labels (will be hashed and checked with 31 | * .equals(..)) 32 | * @param 33 | * the type of the edge labels (will be hashed and checked with 34 | * .equals(..)) 35 | */ 36 | public interface Strategy extends 37 | Generic { 38 | 39 | /** 40 | * starts the corresponding strategy 41 | * 42 | * @param algo 43 | * the algorithm which search space will be used 44 | * @return the set of found frequent Fragments 45 | */ 46 | public Collection> search( 47 | Algorithm algo,int freqThresh); 48 | 49 | } 50 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/search/Strategy.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 16, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package search; 16 | 17 | import java.util.Collection; 18 | 19 | import AlgorithmInterface.Algorithm; 20 | 21 | import dataStructures.HPListGraph; 22 | 23 | 24 | /** 25 | * This interface encapsulates the requirements of a search strategy. 26 | * 27 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 28 | * 29 | * @param 30 | * the type of the node labels (will be hashed and checked with 31 | * .equals(..)) 32 | * @param 33 | * the type of the edge labels (will be hashed and checked with 34 | * .equals(..)) 35 | */ 36 | public interface Strategy extends 37 | Generic { 38 | 39 | /** 40 | * starts the corresponding strategy 41 | * 42 | * @param algo 43 | * the algorithm which search space will be used 44 | * @return the set of found frequent Fragments 45 | */ 46 | public Collection> search( 47 | Algorithm algo,int freqThresh); 48 | 49 | } 50 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/search/Strategy.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 16, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package search; 16 | 17 | import java.util.Collection; 18 | 19 | import AlgorithmInterface.Algorithm; 20 | 21 | import dataStructures.HPListGraph; 22 | 23 | 24 | /** 25 | * This interface encapsulates the requirements of a search strategy. 26 | * 27 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 28 | * 29 | * @param 30 | * the type of the node labels (will be hashed and checked with 31 | * .equals(..)) 32 | * @param 33 | * the type of the edge labels (will be hashed and checked with 34 | * .equals(..)) 35 | */ 36 | public interface Strategy extends 37 | Generic { 38 | 39 | /** 40 | * starts the corresponding strategy 41 | * 42 | * @param algo 43 | * the algorithm which search space will be used 44 | * @return the set of found frequent Fragments 45 | */ 46 | public Collection> search( 47 | Algorithm algo,int freqThresh); 48 | 49 | } 50 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/dataStructures/ConnectedComponent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package dataStructures; 21 | 22 | public class ConnectedComponent 23 | { 24 | 25 | private int indexA; 26 | private int indexB; 27 | private int labelA; 28 | private int labelB; 29 | 30 | public ConnectedComponent(int indexA,int labelA,int indexB ,int labelB) 31 | { 32 | this.labelA=labelA; 33 | this.labelB= labelB; 34 | this.indexA=indexA; 35 | this.indexB=indexB; 36 | } 37 | 38 | public int getLabelA() { 39 | return labelA; 40 | } 41 | 42 | public int getLabelB() { 43 | return labelB; 44 | } 45 | 46 | public int getIndexA() 47 | { 48 | return indexA; 49 | } 50 | 51 | public int getIndexB() 52 | { 53 | return indexB; 54 | } 55 | 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/dataStructures/ConnectedComponent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package dataStructures; 21 | 22 | public class ConnectedComponent 23 | { 24 | 25 | private int indexA; 26 | private int indexB; 27 | private int labelA; 28 | private int labelB; 29 | 30 | public ConnectedComponent(int indexA,int labelA,int indexB ,int labelB) 31 | { 32 | this.labelA=labelA; 33 | this.labelB= labelB; 34 | this.indexA=indexA; 35 | this.indexB=indexB; 36 | } 37 | 38 | public int getLabelA() { 39 | return labelA; 40 | } 41 | 42 | public int getLabelB() { 43 | return labelB; 44 | } 45 | 46 | public int getIndexA() 47 | { 48 | return indexA; 49 | } 50 | 51 | public int getIndexB() 52 | { 53 | return indexB; 54 | } 55 | 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/AlgorithmInterface/Algorithm.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 2, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package AlgorithmInterface; 16 | 17 | import java.io.Serializable; 18 | import java.util.Collection; 19 | import java.util.Iterator; 20 | 21 | import search.Extender; 22 | import search.Generic; 23 | import search.SearchLatticeNode; 24 | 25 | /** 26 | * This interface encapsulate the required abilities of a mining algorithm. 27 | * 28 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 29 | * 30 | * @param 31 | * the type of the node labels (will be hashed and checked with 32 | * .equals(..)) 33 | * @param 34 | * the type of the edge labels (will be hashed and checked with 35 | * .equals(..)) 36 | */ 37 | public interface Algorithm extends 38 | Generic, Serializable { 39 | 40 | /** 41 | * @param threadIdx 42 | * @return a (new) Extender Object for the given thread (index) 43 | */ 44 | public Extender getExtender(int minFreq); 45 | 46 | /** 47 | * @return an iterator over the initial nodes for the search 48 | */ 49 | public Iterator> initialNodes(); 50 | 51 | } 52 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/CSP/VariablePair.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package CSP; 21 | 22 | public class VariablePair 23 | { 24 | public Variable v1; 25 | public Variable v2; 26 | public double edgeLabel; 27 | 28 | public VariablePair(Variable v1,Variable v2, double edgeLabel) 29 | { 30 | this.v1=v1; 31 | this.v2=v2; 32 | this.edgeLabel = edgeLabel; 33 | } 34 | 35 | public String getString() 36 | { 37 | String x = v1.getID()+"-"+edgeLabel+"-"+v2.getID(); 38 | return x; 39 | } 40 | 41 | public boolean containsNewVariable() 42 | { 43 | return v1.isNew()||v2.isNew(); 44 | } 45 | 46 | public int getValuesLength() 47 | { 48 | return v1.getListSize()+v2.getListSize(); 49 | } 50 | 51 | public int getMinValuesLength() 52 | { 53 | if(v1.getListSize(). 18 | */ 19 | 20 | package CSP; 21 | 22 | import java.util.ArrayList; 23 | import java.util.HashMap; 24 | import java.util.HashSet; 25 | 26 | import pruning.SPpruner; 27 | 28 | import dataStructures.ConnectedComponent; 29 | import dataStructures.Graph; 30 | import dataStructures.Query; 31 | import dataStructures.myNode; 32 | 33 | public class ConstraintGraph 34 | { 35 | private Variable[] variables; 36 | private Query qry; 37 | 38 | public ConstraintGraph(Graph graph,Query qry,HashMap> nonCandidates) 39 | { 40 | this.qry=qry; 41 | SPpruner sp = new SPpruner(); 42 | sp.getPrunedLists(graph, qry,nonCandidates); 43 | variables= sp.getVariables(); 44 | } 45 | 46 | public Query getQuery() 47 | { 48 | return qry; 49 | } 50 | 51 | public Variable[] getVariables() { 52 | return variables; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/CSP/ConstraintGraph.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package CSP; 21 | 22 | import java.util.ArrayList; 23 | import java.util.HashMap; 24 | import java.util.HashSet; 25 | 26 | import pruning.SPpruner; 27 | 28 | import dataStructures.ConnectedComponent; 29 | import dataStructures.Graph; 30 | import dataStructures.Query; 31 | import dataStructures.myNode; 32 | 33 | public class ConstraintGraph 34 | { 35 | private Variable[] variables; 36 | private Query qry; 37 | 38 | public ConstraintGraph(Graph graph,Query qry,HashMap> nonCandidates) 39 | { 40 | this.qry=qry; 41 | SPpruner sp = new SPpruner(); 42 | sp.getPrunedLists(graph, qry,nonCandidates); 43 | variables= sp.getVariables(); 44 | } 45 | 46 | public Query getQuery() 47 | { 48 | return qry; 49 | } 50 | 51 | public Variable[] getVariables() { 52 | return variables; 53 | } 54 | 55 | 56 | } 57 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/CSP/ConstraintGraph.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package CSP; 21 | 22 | import java.util.ArrayList; 23 | import java.util.HashMap; 24 | import java.util.HashSet; 25 | 26 | import pruning.SPpruner; 27 | 28 | import dataStructures.ConnectedComponent; 29 | import dataStructures.Graph; 30 | import dataStructures.Query; 31 | import dataStructures.myNode; 32 | 33 | public class ConstraintGraph 34 | { 35 | private Variable[] variables; 36 | private Query qry; 37 | 38 | 39 | 40 | public ConstraintGraph(Graph graph,Query qry,HashMap> nonCandidates) 41 | { 42 | this.qry=qry; 43 | SPpruner sp = new SPpruner(); 44 | sp.getPrunedLists(graph, qry,nonCandidates); 45 | variables= sp.getVariables(); 46 | } 47 | 48 | public Query getQuery() 49 | { 50 | return qry; 51 | } 52 | 53 | public Variable[] getVariables() { 54 | return variables; 55 | } 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/dataStructures/ConnectedComponent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package dataStructures; 21 | 22 | public class ConnectedComponent 23 | { 24 | 25 | private int indexA; 26 | private int indexB; 27 | private int labelA; 28 | private int labelB; 29 | private double edgeLabel; 30 | 31 | public ConnectedComponent(int indexA,int labelA,int indexB ,int labelB, double edgeLabel) 32 | { 33 | this.labelA=labelA; 34 | this.labelB= labelB; 35 | this.indexA=indexA; 36 | this.indexB=indexB; 37 | this.edgeLabel=edgeLabel; 38 | } 39 | 40 | public int getLabelA() { 41 | return labelA; 42 | } 43 | 44 | public int getLabelB() { 45 | return labelB; 46 | } 47 | 48 | public int getIndexA() 49 | { 50 | return indexA; 51 | } 52 | 53 | public int getIndexB() 54 | { 55 | return indexB; 56 | } 57 | 58 | public double getEdgeLabel() 59 | { 60 | return edgeLabel; 61 | } 62 | 63 | 64 | } 65 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/CSP/ConstraintGraph.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package CSP; 21 | 22 | import java.util.ArrayList; 23 | import java.util.HashMap; 24 | import java.util.HashSet; 25 | 26 | import pruning.SPpruner; 27 | 28 | import dataStructures.ConnectedComponent; 29 | import dataStructures.Graph; 30 | import dataStructures.Query; 31 | import dataStructures.myNode; 32 | 33 | public class ConstraintGraph 34 | { 35 | private Variable[] variables; 36 | private Query qry; 37 | 38 | 39 | 40 | public ConstraintGraph(Graph graph,Query qry,HashMap> nonCandidates) 41 | { 42 | this.qry=qry; 43 | SPpruner sp = new SPpruner(); 44 | sp.getPrunedLists(graph, qry,nonCandidates); 45 | variables= sp.getVariables(); 46 | } 47 | 48 | public Query getQuery() 49 | { 50 | return qry; 51 | } 52 | 53 | public Variable[] getVariables() { 54 | return variables; 55 | } 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/dataStructures/ConnectedComponent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package dataStructures; 21 | 22 | public class ConnectedComponent 23 | { 24 | 25 | private int indexA; 26 | private int indexB; 27 | private int labelA; 28 | private int labelB; 29 | private double edgeLabel; 30 | 31 | public ConnectedComponent(int indexA,int labelA,int indexB ,int labelB, double edgeLabel) 32 | { 33 | this.labelA=labelA; 34 | this.labelB= labelB; 35 | this.indexA=indexA; 36 | this.indexB=indexB; 37 | this.edgeLabel=edgeLabel; 38 | } 39 | 40 | public int getLabelA() { 41 | return labelA; 42 | } 43 | 44 | public int getLabelB() { 45 | return labelB; 46 | } 47 | 48 | public int getIndexA() 49 | { 50 | return indexA; 51 | } 52 | 53 | public int getIndexB() 54 | { 55 | return indexB; 56 | } 57 | 58 | public double getEdgeLabel() 59 | { 60 | return edgeLabel; 61 | } 62 | 63 | 64 | } 65 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/utilities/Settings.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package utilities; 21 | 22 | public class Settings 23 | { 24 | 25 | public static boolean isApproximate=false; //EXACT 26 | public static double approxEpsilon = 1.0; 27 | public static double approxConstant = 0; 28 | 29 | public static boolean isAutomorphismOn= true; 30 | 31 | public static boolean isDecomposeOn= true; 32 | 33 | public static boolean CACHING = true; 34 | 35 | public static boolean DISTINCTLABELS = true; 36 | 37 | public static boolean LimitedTime = true; 38 | 39 | public static boolean PRINT = false; 40 | 41 | public static boolean multipleAtts = false; 42 | 43 | //datasets folder 44 | public static String datasetsFolder = "../Datasets/"; 45 | 46 | //given frequency, if not given then its value is -1 47 | public static int frequency = -1; 48 | 49 | //the filename 50 | public static String fileName = null; 51 | } 52 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/Dijkstra/DenseRoutesMap.java: -------------------------------------------------------------------------------- 1 | package Dijkstra; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Iterator; 5 | import java.util.List; 6 | 7 | import dataStructures.Graph; 8 | import dataStructures.HPListGraph; 9 | import dataStructures.IntIterator; 10 | 11 | 12 | /** 13 | * This map stores routes in a matrix, a nxn array. It is most useful when 14 | * there are lots of routes, otherwise using a sparse representation is 15 | * recommended. 16 | * 17 | * @author Renaud Waldura <renaud+tw@waldura.com> 18 | * @version $Id: DenseRoutesMap.java 2367 2007-08-20 21:47:25Z renaud $ 19 | */ 20 | 21 | public class DenseRoutesMap 22 | implements RoutesMap 23 | { 24 | private HPListGraph listGraph; 25 | 26 | public DenseRoutesMap(Graph currentGraph) 27 | { 28 | listGraph=currentGraph.getListGraph(); 29 | } 30 | 31 | /** 32 | * Link two cities by a direct route with the given distance. 33 | */ 34 | public void addDirectRoute(int start, int end, int distance) 35 | { 36 | } 37 | 38 | /** 39 | * @return the distance between the two cities, or 0 if no path exists. 40 | */ 41 | public double getDistance(int start, int end) 42 | { 43 | int index=listGraph.getEdge(start, end); 44 | return listGraph.getEdgeLabel(index); 45 | } 46 | 47 | /** 48 | * @return the list of all valid destinations from the given city. 49 | */ 50 | public List getDestinations(int city) 51 | { 52 | List list = new ArrayList(); 53 | IntIterator it= listGraph.getEdgeIndices(city); 54 | for (; it.hasNext();) 55 | { 56 | int edge= it.next(); 57 | list.add(listGraph.getOtherNode(edge, city)); 58 | } 59 | return list; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/utilities/Settings.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package utilities; 21 | 22 | public class Settings 23 | { 24 | 25 | public static boolean isApproximate=false; //EXACT 26 | public static double approxEpsilon = 0.0001; 27 | public static double approxConstant = 100000; 28 | 29 | public static boolean isAutomorphismOn= true; 30 | 31 | public static boolean isDecomposeOn= true; 32 | 33 | public static boolean CACHING = true; 34 | 35 | public static boolean DISTINCTLABELS = true; 36 | 37 | public static boolean LimitedTime = true; 38 | 39 | public static boolean PRINT = false; 40 | 41 | //datasets folder 42 | public static String datasetsFolder = "../Datasets/"; 43 | 44 | //given frequency, if not given then its value is -1 45 | public static int frequency = -1; 46 | 47 | //the filename 48 | public static String fileName = null; 49 | 50 | //the maximum number of the same label appears in the resulted pattern 51 | public static int numLabelAppears = -1; 52 | } 53 | -------------------------------------------------------------------------------- /Output.txt: -------------------------------------------------------------------------------- 1 | 1.388 2 | 21 3 | 0: 4 | v 0 2 5 | v 1 2 6 | v 2 2 7 | v 3 2 8 | e 0 1 1 9 | e 2 1 1 10 | e 2 3 1 11 | 1: 12 | v 0 2 13 | v 1 2 14 | v 2 2 15 | e 0 1 1 16 | e 2 1 1 17 | 2: 18 | v 0 2 19 | v 1 2 20 | v 2 2 21 | e 0 1 1 22 | e 0 2 1 23 | 3: 24 | v 0 2 25 | v 1 2 26 | e 0 1 1 27 | 4: 28 | v 0 1 29 | v 1 1 30 | v 2 1 31 | v 3 1 32 | e 0 1 1 33 | e 2 1 1 34 | e 2 3 1 35 | e 0 3 1 36 | 5: 37 | v 0 1 38 | v 1 1 39 | v 2 1 40 | v 3 1 41 | v 4 1 42 | e 0 1 1 43 | e 2 1 1 44 | e 2 3 1 45 | e 4 3 1 46 | 6: 47 | v 0 1 48 | v 1 1 49 | v 2 1 50 | v 3 1 51 | v 4 1 52 | v 5 1 53 | e 0 1 1 54 | e 2 1 1 55 | e 2 3 1 56 | e 4 1 1 57 | e 4 5 1 58 | 7: 59 | v 0 1 60 | v 1 1 61 | v 2 1 62 | v 3 1 63 | v 4 1 64 | e 0 1 1 65 | e 2 1 1 66 | e 2 3 1 67 | e 4 1 1 68 | 8: 69 | v 0 1 70 | v 1 1 71 | v 2 1 72 | v 3 1 73 | v 4 1 74 | e 0 1 1 75 | e 2 1 1 76 | e 2 3 1 77 | e 0 4 1 78 | 9: 79 | v 0 1 80 | v 1 1 81 | v 2 1 82 | v 3 1 83 | e 0 1 1 84 | e 2 1 1 85 | e 2 3 1 86 | 10: 87 | v 0 1 88 | v 1 1 89 | v 2 1 90 | v 3 1 91 | e 0 1 1 92 | e 2 1 1 93 | e 3 1 1 94 | 11: 95 | v 0 1 96 | v 1 1 97 | v 2 1 98 | e 0 1 1 99 | e 2 1 1 100 | 12: 101 | v 0 1 102 | v 1 1 103 | v 2 1 104 | e 0 1 1 105 | e 0 2 1 106 | 13: 107 | v 0 1 108 | v 1 1 109 | e 0 1 1 110 | 14: 111 | v 0 0 112 | v 1 0 113 | v 2 0 114 | v 3 0 115 | v 4 0 116 | e 0 1 1 117 | e 2 1 1 118 | e 2 3 1 119 | e 0 4 1 120 | 15: 121 | v 0 0 122 | v 1 0 123 | v 2 0 124 | v 3 0 125 | e 0 1 1 126 | e 2 1 1 127 | e 2 3 1 128 | 16: 129 | v 0 0 130 | v 1 0 131 | v 2 0 132 | e 0 1 1 133 | e 2 1 1 134 | 17: 135 | v 0 0 136 | v 1 0 137 | v 2 0 138 | e 0 1 1 139 | e 0 2 1 140 | 18: 141 | v 0 0 142 | v 1 0 143 | e 0 1 1 144 | 19: 145 | v 0 5 146 | v 1 5 147 | e 0 1 1 148 | 20: 149 | v 0 4 150 | v 1 4 151 | e 0 1 1 152 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/utilities/MyPair.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package utilities; 21 | 22 | import java.util.ArrayList; 23 | import java.util.Iterator; 24 | 25 | public class MyPair { 26 | private A a; 27 | private B b; 28 | 29 | public MyPair(A a, B b) 30 | { 31 | this.a = a; 32 | this.b = b; 33 | } 34 | 35 | public A getA() {return a;} 36 | public B getB() {return b;} 37 | 38 | @Override public boolean equals(Object aThat) { 39 | Object t = null; 40 | //check for self-comparison 41 | if ( this == aThat ) return true; 42 | //actual comparison 43 | if(((Integer)this.a).intValue()==((Integer)((MyPair)aThat).getA()).intValue()) return true; 44 | return false; 45 | } 46 | 47 | public static int getIndexOf(ArrayList> arr, int a) 48 | { 49 | int i = 0; 50 | Iterator> itr = arr.iterator(); 51 | while(itr.hasNext()) { 52 | if(itr.next().getA().intValue()==a) 53 | return i; 54 | i++; 55 | } 56 | return -1; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/utilities/Settings.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package utilities; 21 | 22 | public class Settings 23 | { 24 | 25 | public static boolean isApproximate=false; //EXACT 26 | public static double approxEpsilon = 0.0001; 27 | public static double approxConstant = 100000; 28 | 29 | public static boolean isAutomorphismOn= true; 30 | 31 | public static boolean isDecomposeOn= true; 32 | 33 | public static boolean CACHING = true; 34 | 35 | public static boolean DISTINCTLABELS = true; 36 | 37 | public static boolean LimitedTime = true; 38 | 39 | public static boolean PRINT = false; 40 | 41 | public static boolean multipleAtts = true; 42 | 43 | public static double distance = -1; 44 | 45 | //datasets folder 46 | public static String datasetsFolder = "../Datasets/"; 47 | 48 | //given frequency, if not given then its value is -1 49 | public static int frequency = -1; 50 | 51 | //the filename 52 | public static String fileName = null; 53 | 54 | //the maximum number of the same label appears in the resulted pattern 55 | public static int numLabelAppears = -1; 56 | } 57 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/utilities/MyPair.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package utilities; 21 | 22 | import java.util.ArrayList; 23 | import java.util.Iterator; 24 | 25 | public class MyPair { 26 | private A a; 27 | private B b; 28 | 29 | public MyPair(A a, B b) 30 | { 31 | this.a = a; 32 | this.b = b; 33 | } 34 | 35 | public A getA() {return a;} 36 | public B getB() {return b;} 37 | 38 | @Override public boolean equals(Object aThat) { 39 | Object t = null; 40 | System.out.println(t.toString()); 41 | //check for self-comparison 42 | if ( this == aThat ) return true; 43 | //actual comparison 44 | if(((Integer)this.a).intValue()==((Integer)((MyPair)aThat).getA()).intValue()) return true; 45 | return false; 46 | } 47 | 48 | public static int getIndexOf(ArrayList> arr, int a) 49 | { 50 | int i = 0; 51 | Iterator> itr = arr.iterator(); 52 | while(itr.hasNext()) { 53 | if(itr.next().getA().intValue()==a) 54 | return i; 55 | i++; 56 | } 57 | return -1; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/utilities/MyPair.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package utilities; 21 | 22 | import java.util.ArrayList; 23 | import java.util.Iterator; 24 | 25 | public class MyPair { 26 | private A a; 27 | private B b; 28 | 29 | public MyPair(A a, B b) 30 | { 31 | this.a = a; 32 | this.b = b; 33 | } 34 | 35 | public A getA() {return a;} 36 | public B getB() {return b;} 37 | 38 | @Override public boolean equals(Object aThat) { 39 | Object t = null; 40 | System.out.println(t.toString()); 41 | //check for self-comparison 42 | if ( this == aThat ) return true; 43 | //actual comparison 44 | if(((Integer)this.a).intValue()==((Integer)((MyPair)aThat).getA()).intValue()) return true; 45 | return false; 46 | } 47 | 48 | public static int getIndexOf(ArrayList> arr, int a) 49 | { 50 | int i = 0; 51 | Iterator> itr = arr.iterator(); 52 | while(itr.hasNext()) { 53 | if(itr.next().getA().intValue()==a) 54 | return i; 55 | i++; 56 | } 57 | return -1; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/utilities/MyPair.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package utilities; 21 | 22 | import java.util.ArrayList; 23 | import java.util.Iterator; 24 | 25 | public class MyPair { 26 | private A a; 27 | private B b; 28 | 29 | public MyPair(A a, B b) 30 | { 31 | this.a = a; 32 | this.b = b; 33 | } 34 | 35 | public A getA() {return a;} 36 | public B getB() {return b;} 37 | 38 | @Override public boolean equals(Object aThat) { 39 | Object t = null; 40 | System.out.println(t.toString()); 41 | //check for self-comparison 42 | if ( this == aThat ) return true; 43 | //actual comparison 44 | if(((Integer)this.a).intValue()==((Integer)((MyPair)aThat).getA()).intValue()) return true; 45 | return false; 46 | } 47 | 48 | public static int getIndexOf(ArrayList> arr, int a) 49 | { 50 | int i = 0; 51 | Iterator> itr = arr.iterator(); 52 | while(itr.hasNext()) { 53 | if(itr.next().getA().intValue()==a) 54 | return i; 55 | i++; 56 | } 57 | return -1; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/Dijkstra/DenseRoutesMap.java: -------------------------------------------------------------------------------- 1 | package Dijkstra; 2 | 3 | //TODO change the distances and all functions to be triangular !! 4 | 5 | import java.util.ArrayList; 6 | import java.util.Iterator; 7 | import java.util.List; 8 | 9 | import dataStructures.Graph; 10 | import dataStructures.HPListGraph; 11 | import dataStructures.IntIterator; 12 | 13 | 14 | /** 15 | * This map stores routes in a matrix, a nxn array. It is most useful when 16 | * there are lots of routes, otherwise using a sparse representation is 17 | * recommended. 18 | * 19 | * @author Renaud Waldura <renaud+tw@waldura.com> 20 | * @version $Id: DenseRoutesMap.java 2367 2007-08-20 21:47:25Z renaud $ 21 | */ 22 | 23 | public class DenseRoutesMap 24 | implements RoutesMap 25 | { 26 | private HPListGraph listGraph; 27 | 28 | public DenseRoutesMap(Graph currentGraph) 29 | { 30 | listGraph=currentGraph.getListGraph(); 31 | } 32 | 33 | /** 34 | * Link two cities by a direct route with the given distance. 35 | */ 36 | public void addDirectRoute(int start, int end, int distance) 37 | { 38 | } 39 | 40 | /** 41 | * @return the distance between the two cities, or 0 if no path exists. 42 | */ 43 | public double getDistance(int start, int end) 44 | { 45 | int index=listGraph.getEdge(start, end); 46 | return listGraph.getEdgeLabel(index); 47 | } 48 | 49 | /** 50 | * @return the list of all valid destinations from the given city. 51 | */ 52 | public List getDestinations(int city) 53 | { 54 | List list = new ArrayList(); 55 | IntIterator it= listGraph.getEdgeIndices(city); 56 | for (; it.hasNext();) 57 | { 58 | int edge= it.next(); 59 | if(listGraph.getDirection(edge, city)<0) 60 | continue; 61 | list.add(listGraph.getOtherNode(edge, city)); 62 | 63 | } 64 | return list; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/Dijkstra/DenseRoutesMap.java: -------------------------------------------------------------------------------- 1 | package Dijkstra; 2 | 3 | //TODO change the distances and all functions to be triangular !! 4 | 5 | import java.util.ArrayList; 6 | import java.util.Iterator; 7 | import java.util.List; 8 | 9 | import dataStructures.Graph; 10 | import dataStructures.HPListGraph; 11 | import dataStructures.IntIterator; 12 | 13 | 14 | /** 15 | * This map stores routes in a matrix, a nxn array. It is most useful when 16 | * there are lots of routes, otherwise using a sparse representation is 17 | * recommended. 18 | * 19 | * @author Renaud Waldura <renaud+tw@waldura.com> 20 | * @version $Id: DenseRoutesMap.java 2367 2007-08-20 21:47:25Z renaud $ 21 | */ 22 | 23 | public class DenseRoutesMap 24 | implements RoutesMap 25 | { 26 | private HPListGraph listGraph; 27 | 28 | public DenseRoutesMap(Graph currentGraph) 29 | { 30 | listGraph=currentGraph.getListGraph(); 31 | } 32 | 33 | /** 34 | * Link two cities by a direct route with the given distance. 35 | */ 36 | public void addDirectRoute(int start, int end, int distance) 37 | { 38 | } 39 | 40 | /** 41 | * @return the distance between the two cities, or 0 if no path exists. 42 | */ 43 | public double getDistance(int start, int end) 44 | { 45 | int index=listGraph.getEdge(start, end); 46 | return listGraph.getEdgeLabel(index); 47 | } 48 | 49 | /** 50 | * @return the list of all valid destinations from the given city. 51 | */ 52 | public List getDestinations(int city) 53 | { 54 | List list = new ArrayList(); 55 | IntIterator it= listGraph.getEdgeIndices(city); 56 | for (; it.hasNext();) 57 | { 58 | int edge= it.next(); 59 | if(listGraph.getDirection(edge, city)<0) 60 | continue; 61 | list.add(listGraph.getOtherNode(edge, city)); 62 | 63 | } 64 | return list; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/Dijkstra/DenseRoutesMap.java: -------------------------------------------------------------------------------- 1 | package Dijkstra; 2 | 3 | //TODO change the distances and all functions to be triangular !! 4 | 5 | import java.util.ArrayList; 6 | import java.util.Iterator; 7 | import java.util.List; 8 | 9 | import dataStructures.Graph; 10 | import dataStructures.HPListGraph; 11 | import dataStructures.IntIterator; 12 | 13 | 14 | /** 15 | * This map stores routes in a matrix, a nxn array. It is most useful when 16 | * there are lots of routes, otherwise using a sparse representation is 17 | * recommended. 18 | * 19 | * @author Renaud Waldura <renaud+tw@waldura.com> 20 | * @version $Id: DenseRoutesMap.java 2367 2007-08-20 21:47:25Z renaud $ 21 | */ 22 | 23 | public class DenseRoutesMap 24 | implements RoutesMap 25 | { 26 | private HPListGraph listGraph; 27 | 28 | public DenseRoutesMap(Graph currentGraph) 29 | { 30 | listGraph=currentGraph.getListGraph(); 31 | } 32 | 33 | public HPListGraph getListGraph() 34 | { 35 | return listGraph; 36 | } 37 | 38 | /** 39 | * Link two cities by a direct route with the given distance. 40 | */ 41 | public void addDirectRoute(int start, int end, int distance) 42 | { 43 | } 44 | 45 | /** 46 | * @return the distance between the two cities, or 0 if no path exists. 47 | */ 48 | public double getDistance(int start, int end) 49 | { 50 | int index=listGraph.getEdge(start, end); 51 | return 1; 52 | } 53 | 54 | /** 55 | * @return the list of all valid destinations from the given city. 56 | */ 57 | public List getDestinations(int city) 58 | { 59 | List list = new ArrayList(); 60 | IntIterator it= listGraph.getEdgeIndices(city); 61 | for (; it.hasNext();) 62 | { 63 | int edge= it.next(); 64 | list.add(listGraph.getOtherNode(edge, city)); 65 | 66 | } 67 | return list; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/search/Extender.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 15, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package search; 16 | 17 | import java.util.Collection; 18 | 19 | /** 20 | * This interface encapsulates the functionality to extend one (or more) parent 21 | * nodes to a set of children 22 | * 23 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 24 | * 25 | * @param 26 | * the type of the node labels (will be hashed and checked with 27 | * .equals(..)) 28 | * @param 29 | * the type of the edge labels (will be hashed and checked with 30 | * .equals(..)) 31 | */ 32 | public interface Extender extends 33 | Generic { 34 | 35 | /** 36 | * @param nodes 37 | * @return an iterator over all children of the set of given nodes 38 | * @throws UnsupportedOperationException 39 | * if not supported for the corresponding algorithm 40 | */ 41 | public Collection> getChildren( 42 | Collection> nodes) 43 | throws UnsupportedOperationException; 44 | 45 | /** 46 | * @param node 47 | * @return an iterator over all children of the given node 48 | * @throws UnsupportedOperationException 49 | * if not supported for the corresponding algorithm 50 | */ 51 | public Collection> getChildren( 52 | SearchLatticeNode node) 53 | throws UnsupportedOperationException; 54 | 55 | } 56 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/search/Extender.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 15, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package search; 16 | 17 | import java.util.Collection; 18 | 19 | /** 20 | * This interface encapsulates the functionality to extend one (or more) parent 21 | * nodes to a set of children 22 | * 23 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 24 | * 25 | * @param 26 | * the type of the node labels (will be hashed and checked with 27 | * .equals(..)) 28 | * @param 29 | * the type of the edge labels (will be hashed and checked with 30 | * .equals(..)) 31 | */ 32 | public interface Extender extends 33 | Generic { 34 | 35 | /** 36 | * @param nodes 37 | * @return an iterator over all children of the set of given nodes 38 | * @throws UnsupportedOperationException 39 | * if not supported for the corresponding algorithm 40 | */ 41 | public Collection> getChildren( 42 | Collection> nodes) 43 | throws UnsupportedOperationException; 44 | 45 | /** 46 | * @param node 47 | * @return an iterator over all children of the given node 48 | * @throws UnsupportedOperationException 49 | * if not supported for the corresponding algorithm 50 | */ 51 | public Collection> getChildren( 52 | SearchLatticeNode node) 53 | throws UnsupportedOperationException; 54 | 55 | } 56 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/search/Extender.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 15, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package search; 16 | 17 | import java.util.Collection; 18 | 19 | /** 20 | * This interface encapsulates the functionality to extend one (or more) parent 21 | * nodes to a set of children 22 | * 23 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 24 | * 25 | * @param 26 | * the type of the node labels (will be hashed and checked with 27 | * .equals(..)) 28 | * @param 29 | * the type of the edge labels (will be hashed and checked with 30 | * .equals(..)) 31 | */ 32 | public interface Extender extends 33 | Generic { 34 | 35 | /** 36 | * @param nodes 37 | * @return an iterator over all children of the set of given nodes 38 | * @throws UnsupportedOperationException 39 | * if not supported for the corresponding algorithm 40 | */ 41 | public Collection> getChildren( 42 | Collection> nodes) 43 | throws UnsupportedOperationException; 44 | 45 | /** 46 | * @param node 47 | * @return an iterator over all children of the given node 48 | * @throws UnsupportedOperationException 49 | * if not supported for the corresponding algorithm 50 | */ 51 | public Collection> getChildren( 52 | SearchLatticeNode node) 53 | throws UnsupportedOperationException; 54 | 55 | } 56 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/search/Extender.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 15, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package search; 16 | 17 | import java.util.Collection; 18 | 19 | /** 20 | * This interface encapsulates the functionality to extend one (or more) parent 21 | * nodes to a set of children 22 | * 23 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 24 | * 25 | * @param 26 | * the type of the node labels (will be hashed and checked with 27 | * .equals(..)) 28 | * @param 29 | * the type of the edge labels (will be hashed and checked with 30 | * .equals(..)) 31 | */ 32 | public interface Extender extends 33 | Generic { 34 | 35 | /** 36 | * @param nodes 37 | * @return an iterator over all children of the set of given nodes 38 | * @throws UnsupportedOperationException 39 | * if not supported for the corresponding algorithm 40 | */ 41 | public Collection> getChildren( 42 | Collection> nodes) 43 | throws UnsupportedOperationException; 44 | 45 | /** 46 | * @param node 47 | * @return an iterator over all children of the given node 48 | * @throws UnsupportedOperationException 49 | * if not supported for the corresponding algorithm 50 | */ 51 | public Collection> getChildren( 52 | SearchLatticeNode node) 53 | throws UnsupportedOperationException; 54 | 55 | } 56 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/search/CanonicalPruningStep.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 25, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package search; 16 | 17 | import java.util.Collection; 18 | 19 | import dataStructures.Canonizable; 20 | import dataStructures.Extension; 21 | 22 | 23 | 24 | /** 25 | * This class implements the general pruning of non-canonical fragments. 26 | * 27 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 28 | * 29 | * @param 30 | * the type of the node labels (will be hashed and checked with 31 | * .equals(..)) 32 | * @param 33 | * the type of the edge labels (will be hashed and checked with 34 | * .equals(..)) 35 | */ 36 | public class CanonicalPruningStep extends 37 | MiningStep { 38 | 39 | /** 40 | * creates a new canonical pruning object 41 | * 42 | * @param next 43 | */ 44 | public CanonicalPruningStep(final MiningStep next) { 45 | super(next); 46 | } 47 | 48 | /* 49 | * (non-Javadoc) 50 | * 51 | * @see de.parsemis.miner.MiningStep#call(de.parsemis.miner.SearchLatticeNode, 52 | * java.util.Collection) 53 | */ 54 | @Override 55 | public void call(final SearchLatticeNode node, 56 | final Collection> extensions) { 57 | final Canonizable can = (Canonizable) node; 58 | 59 | if (can.isCanonical()) { 60 | this.callNext(node, extensions); 61 | 62 | } else { 63 | node.store(false); 64 | } 65 | 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/search/CanonicalPruningStep.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 25, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package search; 16 | 17 | import java.util.Collection; 18 | 19 | import dataStructures.Canonizable; 20 | import dataStructures.Extension; 21 | 22 | 23 | 24 | /** 25 | * This class implements the general pruning of non-canonical fragments. 26 | * 27 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 28 | * 29 | * @param 30 | * the type of the node labels (will be hashed and checked with 31 | * .equals(..)) 32 | * @param 33 | * the type of the edge labels (will be hashed and checked with 34 | * .equals(..)) 35 | */ 36 | public class CanonicalPruningStep extends 37 | MiningStep { 38 | 39 | /** 40 | * creates a new canonical pruning object 41 | * 42 | * @param next 43 | */ 44 | public CanonicalPruningStep(final MiningStep next) { 45 | super(next); 46 | } 47 | 48 | /* 49 | * (non-Javadoc) 50 | * 51 | * @see de.parsemis.miner.MiningStep#call(de.parsemis.miner.SearchLatticeNode, 52 | * java.util.Collection) 53 | */ 54 | @Override 55 | public void call(final SearchLatticeNode node, 56 | final Collection> extensions) { 57 | final Canonizable can = (Canonizable) node; 58 | 59 | if (can.isCanonical()) { 60 | this.callNext(node, extensions); 61 | 62 | } else { 63 | node.store(false); 64 | } 65 | 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/search/EmbeddingBasedGenerationStep.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created Jun 9, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package search; 16 | 17 | import java.util.Collection; 18 | import java.util.Iterator; 19 | 20 | import dataStructures.Extension; 21 | 22 | //import de.parsemis.miner.general.HPEmbedding; 23 | 24 | /** 25 | * This class implements the general child generation based on stored 26 | * embeddings. 27 | * 28 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 29 | * 30 | * @param 31 | * the type of the node labels (will be hashed and checked with 32 | * .equals(..)) 33 | * @param 34 | * the type of the edge labels (will be hashed and checked with 35 | * .equals(..)) 36 | */ 37 | public class EmbeddingBasedGenerationStep extends 38 | GenerationStep { 39 | /** 40 | * creates a new GenerationStep 41 | * 42 | * @param next 43 | * the next step of the mining chain 44 | */ 45 | public EmbeddingBasedGenerationStep( 46 | final MiningStep next) { 47 | super(next); 48 | } 49 | 50 | /* 51 | * (non-Javadoc) 52 | * 53 | * @see de.parsemis.miner.MiningStep#call(de.parsemis.miner.SearchLatticeNode, 54 | * java.util.Collection) 55 | */ 56 | @Override 57 | public void call(final SearchLatticeNode node, 58 | final Collection> extensions) { 59 | super.reset(); 60 | super.call(node); 61 | super.call(node, extensions); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/search/EmbeddingBasedGenerationStep.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created Jun 9, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package search; 16 | 17 | import java.util.Collection; 18 | import java.util.Iterator; 19 | 20 | import dataStructures.Extension; 21 | 22 | //import de.parsemis.miner.general.HPEmbedding; 23 | 24 | /** 25 | * This class implements the general child generation based on stored 26 | * embeddings. 27 | * 28 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 29 | * 30 | * @param 31 | * the type of the node labels (will be hashed and checked with 32 | * .equals(..)) 33 | * @param 34 | * the type of the edge labels (will be hashed and checked with 35 | * .equals(..)) 36 | */ 37 | public class EmbeddingBasedGenerationStep extends 38 | GenerationStep { 39 | /** 40 | * creates a new GenerationStep 41 | * 42 | * @param next 43 | * the next step of the mining chain 44 | */ 45 | public EmbeddingBasedGenerationStep( 46 | final MiningStep next) { 47 | super(next); 48 | } 49 | 50 | /* 51 | * (non-Javadoc) 52 | * 53 | * @see de.parsemis.miner.MiningStep#call(de.parsemis.miner.SearchLatticeNode, 54 | * java.util.Collection) 55 | */ 56 | @Override 57 | public void call(final SearchLatticeNode node, 58 | final Collection> extensions) { 59 | super.reset(); 60 | super.call(node); 61 | super.call(node, extensions); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/search/EmbeddingBasedGenerationStep.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created Jun 9, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package search; 16 | 17 | import java.util.Collection; 18 | import java.util.Iterator; 19 | 20 | import dataStructures.Extension; 21 | 22 | //import de.parsemis.miner.general.HPEmbedding; 23 | 24 | /** 25 | * This class implements the general child generation based on stored 26 | * embeddings. 27 | * 28 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 29 | * 30 | * @param 31 | * the type of the node labels (will be hashed and checked with 32 | * .equals(..)) 33 | * @param 34 | * the type of the edge labels (will be hashed and checked with 35 | * .equals(..)) 36 | */ 37 | public class EmbeddingBasedGenerationStep extends 38 | GenerationStep { 39 | /** 40 | * creates a new GenerationStep 41 | * 42 | * @param next 43 | * the next step of the mining chain 44 | */ 45 | public EmbeddingBasedGenerationStep( 46 | final MiningStep next) { 47 | super(next); 48 | } 49 | 50 | /* 51 | * (non-Javadoc) 52 | * 53 | * @see de.parsemis.miner.MiningStep#call(de.parsemis.miner.SearchLatticeNode, 54 | * java.util.Collection) 55 | */ 56 | @Override 57 | public void call(final SearchLatticeNode node, 58 | final Collection> extensions) { 59 | super.reset(); 60 | super.call(node); 61 | super.call(node, extensions); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/search/EmbeddingBasedGenerationStep.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created Jun 9, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package search; 16 | 17 | import java.util.Collection; 18 | import java.util.Iterator; 19 | 20 | import dataStructures.Extension; 21 | 22 | //import de.parsemis.miner.general.HPEmbedding; 23 | 24 | /** 25 | * This class implements the general child generation based on stored 26 | * embeddings. 27 | * 28 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 29 | * 30 | * @param 31 | * the type of the node labels (will be hashed and checked with 32 | * .equals(..)) 33 | * @param 34 | * the type of the edge labels (will be hashed and checked with 35 | * .equals(..)) 36 | */ 37 | public class EmbeddingBasedGenerationStep extends 38 | GenerationStep { 39 | /** 40 | * creates a new GenerationStep 41 | * 42 | * @param next 43 | * the next step of the mining chain 44 | */ 45 | public EmbeddingBasedGenerationStep( 46 | final MiningStep next) { 47 | super(next); 48 | } 49 | 50 | /* 51 | * (non-Javadoc) 52 | * 53 | * @see de.parsemis.miner.MiningStep#call(de.parsemis.miner.SearchLatticeNode, 54 | * java.util.Collection) 55 | */ 56 | @Override 57 | public void call(final SearchLatticeNode node, 58 | final Collection> extensions) { 59 | super.reset(); 60 | super.call(node); 61 | super.call(node, extensions); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/dataStructures/DFScodeSerializer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package dataStructures; 21 | 22 | import java.util.BitSet; 23 | 24 | 25 | public class DFScodeSerializer 26 | { 27 | 28 | 29 | public static String serialize(final HPListGraph graph) { 30 | // serialize graph 31 | String text = ""; 32 | //text += "t # " + graph.getName() + "\n"; 33 | 34 | 35 | BitSet nodes= graph.getNodes(); 36 | BitSet edges= graph.getEdges(); 37 | for (int nodeIdx = nodes.nextSetBit(0); nodeIdx >= 0; nodeIdx = nodes.nextSetBit(nodeIdx + 1)) 38 | { 39 | int label= (Integer)graph.getNodeLabel(nodeIdx); 40 | text += "v " + nodeIdx + " " 41 | + label + "\n"; 42 | 43 | } 44 | 45 | for (int edgeIdx = edges.nextSetBit(0); edgeIdx >= 0; edgeIdx = edges.nextSetBit(edgeIdx + 1)) 46 | { 47 | int node1=graph.getNodeA(edgeIdx); 48 | int node2=graph.getNodeB(edgeIdx); 49 | int edgeLabel=Integer.parseInt((String)graph.getEdgeLabel(edgeIdx)); 50 | if(graph.getDirection(edgeIdx)>=0) 51 | {text += "e " + node1 52 | + " " + node2 53 | + " " + edgeLabel + "\n";} 54 | else 55 | {text += "e " + node2 56 | + " " + node1 57 | + " " + edgeLabel + "\n";} 58 | } 59 | 60 | return text; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/dataStructures/DFScodeSerializer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package dataStructures; 21 | 22 | import java.util.BitSet; 23 | 24 | 25 | public class DFScodeSerializer 26 | { 27 | 28 | 29 | public static String serialize(final HPListGraph graph) { 30 | // serialize graph 31 | String text = ""; 32 | //text += "t # " + graph.getName() + "\n"; 33 | 34 | 35 | BitSet nodes= graph.getNodes(); 36 | BitSet edges= graph.getEdges(); 37 | for (int nodeIdx = nodes.nextSetBit(0); nodeIdx >= 0; nodeIdx = nodes.nextSetBit(nodeIdx + 1)) 38 | { 39 | int label= (Integer)graph.getNodeLabel(nodeIdx); 40 | text += "v " + nodeIdx + " " 41 | + label + "\n"; 42 | 43 | } 44 | 45 | for (int edgeIdx = edges.nextSetBit(0); edgeIdx >= 0; edgeIdx = edges.nextSetBit(edgeIdx + 1)) 46 | { 47 | int node1=graph.getNodeA(edgeIdx); 48 | int node2=graph.getNodeB(edgeIdx); 49 | int edgeLabel=Integer.parseInt((String)graph.getEdgeLabel(edgeIdx)); 50 | if(graph.getDirection(edgeIdx)>=0) 51 | {text += "e " + node1 52 | + " " + node2 53 | + " " + edgeLabel + "\n";} 54 | else 55 | {text += "e " + node2 56 | + " " + node1 57 | + " " + edgeLabel + "\n";} 58 | } 59 | 60 | return text; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/dataStructures/DFScodeSerializer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package dataStructures; 21 | 22 | import java.util.BitSet; 23 | 24 | 25 | public class DFScodeSerializer 26 | { 27 | 28 | 29 | public static String serialize(final HPListGraph graph) { 30 | // serialize graph 31 | String text = ""; 32 | //text += "t # " + graph.getName() + "\n"; 33 | 34 | 35 | BitSet nodes= graph.getNodes(); 36 | BitSet edges= graph.getEdges(); 37 | for (int nodeIdx = nodes.nextSetBit(0); nodeIdx >= 0; nodeIdx = nodes.nextSetBit(nodeIdx + 1)) 38 | { 39 | int label= (Integer)graph.getNodeLabel(nodeIdx); 40 | text += "v " + nodeIdx + " " 41 | + label + "\n"; 42 | 43 | } 44 | 45 | for (int edgeIdx = edges.nextSetBit(0); edgeIdx >= 0; edgeIdx = edges.nextSetBit(edgeIdx + 1)) 46 | { 47 | int node1=graph.getNodeA(edgeIdx); 48 | int node2=graph.getNodeB(edgeIdx); 49 | int edgeLabel=Integer.parseInt((String)graph.getEdgeLabel(edgeIdx)); 50 | if(graph.getDirection(edgeIdx)>=0) 51 | {text += "e " + node1 52 | + " " + node2 53 | + " " + edgeLabel + "\n";} 54 | else 55 | {text += "e " + node2 56 | + " " + node1 57 | + " " + edgeLabel + "\n";} 58 | } 59 | 60 | return text; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/dataStructures/DFScodeSerializer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package dataStructures; 21 | 22 | import java.util.BitSet; 23 | 24 | 25 | public class DFScodeSerializer 26 | { 27 | 28 | 29 | public static String serialize(final HPListGraph graph) { 30 | // serialize graph 31 | String text = ""; 32 | //text += "t # " + graph.getName() + "\n"; 33 | 34 | 35 | BitSet nodes= graph.getNodes(); 36 | BitSet edges= graph.getEdges(); 37 | for (int nodeIdx = nodes.nextSetBit(0); nodeIdx >= 0; nodeIdx = nodes.nextSetBit(nodeIdx + 1)) 38 | { 39 | int label= (Integer)graph.getNodeLabel(nodeIdx); 40 | text += "v " + nodeIdx + " " 41 | + label + "\n"; 42 | 43 | } 44 | 45 | for (int edgeIdx = edges.nextSetBit(0); edgeIdx >= 0; edgeIdx = edges.nextSetBit(edgeIdx + 1)) 46 | { 47 | int node1=graph.getNodeA(edgeIdx); 48 | int node2=graph.getNodeB(edgeIdx); 49 | int edgeLabel=Integer.parseInt((String)graph.getEdgeLabel(edgeIdx)); 50 | if(graph.getDirection(edgeIdx)>=0) 51 | {text += "e " + node1 52 | + " " + node2 53 | + " " + edgeLabel + "\n";} 54 | else 55 | {text += "e " + node2 56 | + " " + node1 57 | + " " + edgeLabel + "\n";} 58 | } 59 | 60 | return text; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/utilities/Settings.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package utilities; 21 | 22 | public class Settings 23 | { 24 | 25 | public static boolean isApproximate=false; //EXACT 26 | public static double approxEpsilon = 0.0001; 27 | public static double approxConstant = 100000; 28 | 29 | public static boolean isAutomorphismOn= true; 30 | 31 | public static boolean isDecomposeOn= true; 32 | 33 | public static boolean CACHING = true; 34 | 35 | public static boolean DISTINCTLABELS = true; 36 | 37 | public static boolean LimitedTime = true; 38 | 39 | public static boolean PRINT = false; 40 | 41 | //the distance threshold (this is in the case of FPM (type=1) 42 | public static double distance = -1; 43 | 44 | //patterns output file 45 | public static String RoutputFolder = "./Results/GraMi/"; 46 | 47 | //datasets folder 48 | public static String datasetsFolder = "../Datasets/"; 49 | 50 | //the filename 51 | public static String fileName = null; 52 | 53 | //given frequency, if not given then its value is -1 54 | public static int frequency = -1; 55 | 56 | //used dataset 57 | public static int Dataset = -1; 58 | 59 | //the maximum number of the same label appears in the resulted pattern 60 | public static int numLabelAppears = -1; 61 | } 62 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/temp/Reminder.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | */ 18 | 19 | package temp; 20 | 21 | import java.util.Timer; 22 | import java.util.TimerTask; 23 | 24 | public class Reminder { 25 | Timer timer; 26 | application app; 27 | 28 | public Reminder(int seconds) { 29 | 30 | app = new application(); 31 | app.start(); 32 | timer = new Timer(true); 33 | timer.schedule(new RemindTask(), seconds*1000); 34 | 35 | 36 | } 37 | 38 | class RemindTask extends TimerTask { 39 | public void run() { 40 | System.out.format("Time's up!"); 41 | 42 | System.out.println(app.isAlive()); 43 | app.stopIT(); 44 | System.out.println(app.isAlive()); 45 | } 46 | } 47 | class application extends Thread { 48 | volatile boolean stop=false; 49 | public void run() { 50 | 51 | int counter=0; 52 | while (!stop) 53 | { 54 | //System.out.println(counter++); 55 | } 56 | System.out.println("stopped"); 57 | } 58 | 59 | public void stopIT() 60 | { 61 | stop=true; 62 | } 63 | 64 | } 65 | 66 | 67 | 68 | public static void main(String args[]) { 69 | new Reminder(7); 70 | System.out.format("Task scheduled."); 71 | } 72 | } -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/temp/Reminder.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package temp; 21 | 22 | import java.util.Timer; 23 | import java.util.TimerTask; 24 | 25 | public class Reminder { 26 | Timer timer; 27 | application app; 28 | 29 | public Reminder(int seconds) { 30 | 31 | app = new application(); 32 | app.start(); 33 | timer = new Timer(true); 34 | timer.schedule(new RemindTask(), seconds*1000); 35 | 36 | 37 | } 38 | 39 | class RemindTask extends TimerTask { 40 | public void run() { 41 | System.out.format("Time's up!%n"); 42 | 43 | System.out.println(app.isAlive()); 44 | app.stopIT(); 45 | System.out.println(app.isAlive()); 46 | //timer.cancel(); 47 | } 48 | } 49 | class application extends Thread { 50 | volatile boolean stop=false; 51 | public void run() { 52 | 53 | int counter=0; 54 | while (!stop) 55 | { 56 | 57 | } 58 | } 59 | 60 | public void stopIT() 61 | { 62 | stop=true; 63 | } 64 | 65 | } 66 | 67 | public static void main(String args[]) { 68 | new Reminder(7); 69 | System.out.format("Task scheduled."); 70 | } 71 | } -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/search/CanonicalPruningStep.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 25, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package search; 16 | 17 | import java.util.Collection; 18 | 19 | import dataStructures.Canonizable; 20 | import dataStructures.Extension; 21 | 22 | 23 | 24 | /** 25 | * This class implements the general pruning of non-canonical fragments. 26 | * 27 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 28 | * 29 | * @param 30 | * the type of the node labels (will be hashed and checked with 31 | * .equals(..)) 32 | * @param 33 | * the type of the edge labels (will be hashed and checked with 34 | * .equals(..)) 35 | */ 36 | public class CanonicalPruningStep extends 37 | MiningStep { 38 | 39 | /** 40 | * creates a new canonical pruning object 41 | * 42 | * @param next 43 | */ 44 | public CanonicalPruningStep(final MiningStep next) { 45 | super(next); 46 | } 47 | 48 | /* 49 | * (non-Javadoc) 50 | * 51 | * @see de.parsemis.miner.MiningStep#call(de.parsemis.miner.SearchLatticeNode, 52 | * java.util.Collection) 53 | */ 54 | @Override 55 | public void call(final SearchLatticeNode node, 56 | final Collection> extensions) { 57 | final Canonizable can = (Canonizable) node; 58 | 59 | System.out.println("calculating is Canonical?..."); 60 | if (can.isCanonical()) { 61 | System.out.println("....is Canonical"); 62 | this.callNext(node, extensions); 63 | 64 | } else { 65 | System.out.println("....is NOT Canonical"); 66 | node.store(false); 67 | } 68 | 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/statistics/DistinctLabelStat.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package statistics; 21 | 22 | import java.awt.Point; 23 | 24 | public class DistinctLabelStat 25 | { 26 | int numberOfPatterns; 27 | Point maxNode; 28 | Point maxEdge; 29 | int maxNodeIndex; 30 | int maxEdgeIndex; 31 | public DistinctLabelStat(int numberOfPatterns,Point maxNode,Point maxEdge,int maxNodeIndex,int maxEdgeIndex) 32 | { 33 | this.numberOfPatterns=numberOfPatterns; 34 | this.maxNode=maxNode; 35 | this.maxEdge=maxEdge; 36 | this.maxNodeIndex=maxNodeIndex; 37 | this.maxEdgeIndex=maxEdgeIndex; 38 | } 39 | 40 | public String toString2() 41 | { 42 | String out =""+numberOfPatterns+","; 43 | out+=printPoint2(maxNode,maxNodeIndex)+","; 44 | out+=printPoint2(maxEdge,maxEdgeIndex); 45 | return out; 46 | } 47 | 48 | private String printPoint2(Point p,int index) 49 | { 50 | String pair=""; 51 | pair+=p.x+"-"+p.y; 52 | return pair; 53 | } 54 | 55 | @Override 56 | public String toString() 57 | { 58 | String out ="{ "+numberOfPatterns+","; 59 | out+=printPoint(maxNode,maxNodeIndex)+","; 60 | out+=printPoint(maxEdge,maxEdgeIndex); 61 | out+=" }"; 62 | return out; 63 | } 64 | 65 | private String printPoint(Point p,int index) 66 | { 67 | String pair="("; 68 | pair+=p.x+","+p.y+")"+":"+index; 69 | return pair; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/statistics/DistinctLabelStat.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package statistics; 21 | 22 | import java.awt.Point; 23 | 24 | public class DistinctLabelStat 25 | { 26 | int numberOfPatterns; 27 | Point maxNode; 28 | Point maxEdge; 29 | int maxNodeIndex; 30 | int maxEdgeIndex; 31 | public DistinctLabelStat(int numberOfPatterns,Point maxNode,Point maxEdge,int maxNodeIndex,int maxEdgeIndex) 32 | { 33 | this.numberOfPatterns=numberOfPatterns; 34 | this.maxNode=maxNode; 35 | this.maxEdge=maxEdge; 36 | this.maxNodeIndex=maxNodeIndex; 37 | this.maxEdgeIndex=maxEdgeIndex; 38 | } 39 | 40 | public String toString2() 41 | { 42 | String out =""+numberOfPatterns+","; 43 | out+=printPoint2(maxNode,maxNodeIndex)+","; 44 | out+=printPoint2(maxEdge,maxEdgeIndex); 45 | return out; 46 | } 47 | 48 | private String printPoint2(Point p,int index) 49 | { 50 | String pair=""; 51 | pair+=p.x+"-"+p.y; 52 | return pair; 53 | } 54 | 55 | @Override 56 | public String toString() 57 | { 58 | String out ="{ "+numberOfPatterns+","; 59 | out+=printPoint(maxNode,maxNodeIndex)+","; 60 | out+=printPoint(maxEdge,maxEdgeIndex); 61 | out+=" }"; 62 | return out; 63 | } 64 | 65 | private String printPoint(Point p,int index) 66 | { 67 | String pair="("; 68 | pair+=p.x+","+p.y+")"+":"+index; 69 | return pair; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/statistics/DistinctLabelStat.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package statistics; 21 | 22 | import java.awt.Point; 23 | 24 | public class DistinctLabelStat 25 | { 26 | int numberOfPatterns; 27 | Point maxNode; 28 | Point maxEdge; 29 | int maxNodeIndex; 30 | int maxEdgeIndex; 31 | public DistinctLabelStat(int numberOfPatterns,Point maxNode,Point maxEdge,int maxNodeIndex,int maxEdgeIndex) 32 | { 33 | this.numberOfPatterns=numberOfPatterns; 34 | this.maxNode=maxNode; 35 | this.maxEdge=maxEdge; 36 | this.maxNodeIndex=maxNodeIndex; 37 | this.maxEdgeIndex=maxEdgeIndex; 38 | } 39 | 40 | public String toString2() 41 | { 42 | String out =""+numberOfPatterns+","; 43 | out+=printPoint2(maxNode,maxNodeIndex)+","; 44 | out+=printPoint2(maxEdge,maxEdgeIndex); 45 | return out; 46 | } 47 | 48 | private String printPoint2(Point p,int index) 49 | { 50 | String pair=""; 51 | pair+=p.x+"-"+p.y; 52 | return pair; 53 | } 54 | 55 | @Override 56 | public String toString() 57 | { 58 | String out ="{ "+numberOfPatterns+","; 59 | out+=printPoint(maxNode,maxNodeIndex)+","; 60 | out+=printPoint(maxEdge,maxEdgeIndex); 61 | out+=" }"; 62 | return out; 63 | } 64 | 65 | private String printPoint(Point p,int index) 66 | { 67 | String pair="("; 68 | pair+=p.x+","+p.y+")"+":"+index; 69 | return pair; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/temp/Reminder.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package temp; 21 | 22 | import java.util.Timer; 23 | import java.util.TimerTask; 24 | 25 | public class Reminder { 26 | Timer timer; 27 | application app; 28 | 29 | public Reminder(int seconds) { 30 | 31 | app = new application(); 32 | app.start(); 33 | timer = new Timer(true); 34 | timer.schedule(new RemindTask(), seconds*1000); 35 | 36 | 37 | } 38 | 39 | class RemindTask extends TimerTask { 40 | public void run() { 41 | System.out.format("Time's up!%n"); 42 | 43 | System.out.println(app.isAlive()); 44 | app.stopIT(); 45 | System.out.println(app.isAlive()); 46 | } 47 | } 48 | class application extends Thread { 49 | volatile boolean stop=false; 50 | public void run() { 51 | 52 | int counter=0; 53 | while (!stop) 54 | { 55 | //System.out.println(counter++); 56 | } 57 | System.out.println("stopped"); 58 | } 59 | 60 | public void stopIT() 61 | { 62 | stop=true; 63 | } 64 | 65 | } 66 | 67 | 68 | 69 | public static void main(String args[]) { 70 | new Reminder(7); 71 | System.out.format("Task scheduled.%n"); 72 | } 73 | } -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/statistics/DistinctLabelStat.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package statistics; 21 | 22 | import java.awt.Point; 23 | 24 | public class DistinctLabelStat 25 | { 26 | int numberOfPatterns; 27 | Point maxNode; 28 | Point maxEdge; 29 | int maxNodeIndex; 30 | int maxEdgeIndex; 31 | public DistinctLabelStat(int numberOfPatterns,Point maxNode,Point maxEdge,int maxNodeIndex,int maxEdgeIndex) 32 | { 33 | this.numberOfPatterns=numberOfPatterns; 34 | this.maxNode=maxNode; 35 | this.maxEdge=maxEdge; 36 | this.maxNodeIndex=maxNodeIndex; 37 | this.maxEdgeIndex=maxEdgeIndex; 38 | } 39 | 40 | public String toString2() 41 | { 42 | String out =""+numberOfPatterns+","; 43 | out+=printPoint2(maxNode,maxNodeIndex)+","; 44 | out+=printPoint2(maxEdge,maxEdgeIndex); 45 | //out+=""; 46 | return out; 47 | } 48 | 49 | private String printPoint2(Point p,int index) 50 | { 51 | String pair=""; 52 | pair+=p.x+"-"+p.y; 53 | return pair; 54 | } 55 | 56 | @Override 57 | public String toString() 58 | { 59 | String out ="{ "+numberOfPatterns+","; 60 | out+=printPoint(maxNode,maxNodeIndex)+","; 61 | out+=printPoint(maxEdge,maxEdgeIndex); 62 | out+=" }"; 63 | return out; 64 | } 65 | 66 | private String printPoint(Point p,int index) 67 | { 68 | String pair="("; 69 | pair+=p.x+","+p.y+")"+":"+index; 70 | return pair; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/dataStructures/Query.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package dataStructures; 21 | 22 | import java.util.ArrayList; 23 | 24 | public class Query 25 | { 26 | private HPListGraph listGraph; 27 | 28 | public Query(Graph g) { 29 | listGraph=g.getListGraph(); 30 | } 31 | 32 | public Query(HPListGraph lsGraph) { 33 | listGraph=lsGraph; 34 | } 35 | 36 | 37 | 38 | public HPListGraph getListGraph() { 39 | return listGraph; 40 | } 41 | 42 | 43 | public ArrayList getConnectedLabels() 44 | { 45 | ArrayList cls = new ArrayList(); 46 | 47 | HPListGraph hp = listGraph; 48 | for (int edge = hp.getEdges().nextSetBit(0); edge >= 0; edge = hp.getEdges().nextSetBit(edge + 1)) 49 | { 50 | int nodeA,nodeB,labelA,labelB; 51 | 52 | if(hp.getDirection(edge)>=0) 53 | { 54 | nodeA= hp.getNodeA(edge); labelA=hp.getNodeLabel(nodeA); 55 | nodeB = hp.getNodeB(edge);labelB=hp.getNodeLabel(nodeB); 56 | } 57 | else 58 | { 59 | nodeB= hp.getNodeA(edge); labelB=hp.getNodeLabel(nodeB); 60 | nodeA = hp.getNodeB(edge);labelA=hp.getNodeLabel(nodeA); 61 | } 62 | 63 | 64 | ConnectedComponent cl = new ConnectedComponent(nodeA,labelA, nodeB,labelB); 65 | cls.add(cl); 66 | } 67 | return cls; 68 | } 69 | 70 | 71 | 72 | } 73 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/CSP/SearchOrder.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package CSP; 21 | 22 | public class SearchOrder 23 | { 24 | 25 | private int[] order; 26 | private int addCounter=0; 27 | private int getCounter=0; 28 | public SearchOrder(int size) 29 | { 30 | order= new int[size]; 31 | for (int i = 0; i < size; i++) 32 | { 33 | order[i]=-1; 34 | } 35 | } 36 | 37 | public void addNext(int index) 38 | { 39 | if(addCounter>=order.length) 40 | { 41 | return; 42 | } 43 | order[addCounter]=index; 44 | addCounter++; 45 | } 46 | 47 | public int getNext() 48 | { 49 | if(getCounter>=order.length) 50 | {return -1;} 51 | getCounter++; 52 | return order[getCounter-1]; 53 | } 54 | 55 | public void stepBack() 56 | { 57 | if(getCounter==0) 58 | return; 59 | getCounter--; 60 | } 61 | 62 | public void reset() 63 | { 64 | getCounter=1; 65 | } 66 | 67 | public int getSecondOrderValue(int index1, int index2) 68 | { 69 | int value1=-1,value2=-1; //value represents the search order 70 | for (int i = 0; i < order.length; i++) 71 | { 72 | if(order[i]==index1) 73 | value1=i; 74 | else if(order[i]==index2) 75 | value2=i; 76 | } 77 | if(value1>value2) 78 | return value1; 79 | else 80 | return value2; 81 | } 82 | public int getVariableIndex(int searchOrderIndex) 83 | { 84 | return order[searchOrderIndex]; 85 | } 86 | 87 | 88 | } 89 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/dataStructures/Query.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package dataStructures; 21 | 22 | import java.util.ArrayList; 23 | 24 | public class Query 25 | { 26 | //private Graph graph; 27 | private HPListGraph listGraph; 28 | 29 | public Query(Graph g) { 30 | listGraph=g.getListGraph(); 31 | } 32 | 33 | public Query(HPListGraph lsGraph) { 34 | listGraph=lsGraph; 35 | } 36 | 37 | 38 | 39 | public HPListGraph getListGraph() { 40 | return listGraph; 41 | } 42 | 43 | 44 | public ArrayList getConnectedLabels() 45 | { 46 | ArrayList cls = new ArrayList(); 47 | 48 | HPListGraph hp = listGraph; 49 | for (int edge = hp.getEdges().nextSetBit(0); edge >= 0; edge = hp.getEdges().nextSetBit(edge + 1)) 50 | { 51 | int nodeA,nodeB,labelA,labelB; 52 | 53 | if(hp.getDirection(edge)>=0) 54 | { 55 | nodeA= hp.getNodeA(edge); labelA=hp.getNodeLabel(nodeA); 56 | nodeB = hp.getNodeB(edge);labelB=hp.getNodeLabel(nodeB); 57 | } 58 | else 59 | { 60 | nodeB= hp.getNodeA(edge); labelB=hp.getNodeLabel(nodeB); 61 | nodeA = hp.getNodeB(edge);labelA=hp.getNodeLabel(nodeA); 62 | } 63 | 64 | 65 | ConnectedComponent cl = new ConnectedComponent(nodeA,labelA, nodeB,labelB); 66 | cls.add(cl); 67 | } 68 | return cls; 69 | } 70 | 71 | 72 | 73 | } 74 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/search/CanonicalPruningStep.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 25, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package search; 16 | 17 | import java.util.Collection; 18 | 19 | import dataStructures.Canonizable; 20 | import dataStructures.Extension; 21 | 22 | 23 | 24 | /** 25 | * This class implements the general pruning of non-canonical fragments. 26 | * 27 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 28 | * 29 | * @param 30 | * the type of the node labels (will be hashed and checked with 31 | * .equals(..)) 32 | * @param 33 | * the type of the edge labels (will be hashed and checked with 34 | * .equals(..)) 35 | */ 36 | public class CanonicalPruningStep extends 37 | MiningStep { 38 | 39 | /** 40 | * creates a new canonical pruning object 41 | * 42 | * @param next 43 | */ 44 | public CanonicalPruningStep(final MiningStep next) { 45 | super(next); 46 | } 47 | 48 | /* 49 | * (non-Javadoc) 50 | * 51 | * @see de.parsemis.miner.MiningStep#call(de.parsemis.miner.SearchLatticeNode, 52 | * java.util.Collection) 53 | */ 54 | @Override 55 | public void call(final SearchLatticeNode node, 56 | final Collection> extensions) { 57 | final Canonizable can = (Canonizable) node; 58 | 59 | System.out.println("calculating is Canonical?..."); 60 | if (can.isCanonical()) { 61 | System.out.println("....is Canonical"); 62 | this.callNext(node, extensions); 63 | 64 | } else { 65 | System.out.println("....is NOT Canonical"); 66 | node.store(false); 67 | //node.toHPFragment().deleteFile(); 68 | //LocalEnvironment.env(this).stats.duplicateFragments++; 69 | } 70 | 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/CSP/SearchOrder.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package CSP; 21 | 22 | public class SearchOrder 23 | { 24 | 25 | private int[] order; 26 | private int addCounter=0; 27 | private int getCounter=0; 28 | public SearchOrder(int size) 29 | { 30 | order= new int[size]; 31 | for (int i = 0; i < size; i++) 32 | { 33 | order[i]=-1; 34 | } 35 | } 36 | 37 | public void addNext(int index) 38 | { 39 | if(addCounter>=order.length) 40 | { System.out.println("ERROR IN ADDING order!!"); return;} 41 | order[addCounter]=index; 42 | addCounter++; 43 | } 44 | 45 | public int getNext() 46 | { 47 | if(getCounter>=order.length) 48 | {return -1;} 49 | getCounter++; 50 | return order[getCounter-1]; 51 | } 52 | 53 | public void stepBack() 54 | { 55 | if(getCounter==0) 56 | return; 57 | getCounter--; 58 | } 59 | 60 | public void reset() 61 | { 62 | getCounter=1; 63 | } 64 | 65 | public int getSecondOrderValue(int index1, int index2) 66 | { 67 | int value1=-1,value2=-1; //value represents the search order 68 | for (int i = 0; i < order.length; i++) 69 | { 70 | if(order[i]==index1) 71 | value1=i; 72 | else if(order[i]==index2) 73 | value2=i; 74 | } 75 | 76 | if(value1>value2) 77 | return value1; 78 | else 79 | return value2; 80 | } 81 | public int getVariableIndex(int searchOrderIndex) 82 | { 83 | return order[searchOrderIndex]; 84 | } 85 | 86 | 87 | } 88 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/CSP/SearchOrder.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package CSP; 21 | 22 | public class SearchOrder 23 | { 24 | 25 | private int[] order; 26 | private int addCounter=0; 27 | private int getCounter=0; 28 | public SearchOrder(int size) 29 | { 30 | order= new int[size]; 31 | for (int i = 0; i < size; i++) 32 | { 33 | order[i]=-1; 34 | } 35 | } 36 | 37 | public void addNext(int index) 38 | { 39 | if(addCounter>=order.length) 40 | { System.out.println("ERROR IN ADDING order!!"); return;} 41 | order[addCounter]=index; 42 | addCounter++; 43 | } 44 | 45 | public int getNext() 46 | { 47 | if(getCounter>=order.length) 48 | {return -1;} 49 | getCounter++; 50 | return order[getCounter-1]; 51 | } 52 | 53 | public void stepBack() 54 | { 55 | if(getCounter==0) 56 | return; 57 | getCounter--; 58 | } 59 | 60 | public void reset() 61 | { 62 | getCounter=1; 63 | } 64 | 65 | public int getSecondOrderValue(int index1, int index2) 66 | { 67 | int value1=-1,value2=-1; //value represents the search order 68 | for (int i = 0; i < order.length; i++) 69 | { 70 | if(order[i]==index1) 71 | value1=i; 72 | else if(order[i]==index2) 73 | value2=i; 74 | } 75 | 76 | if(value1>value2) 77 | return value1; 78 | else 79 | return value2; 80 | } 81 | public int getVariableIndex(int searchOrderIndex) 82 | { 83 | return order[searchOrderIndex]; 84 | } 85 | 86 | 87 | } 88 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/CSP/SearchOrder.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package CSP; 21 | 22 | public class SearchOrder 23 | { 24 | 25 | private int[] order; 26 | private int addCounter=0; 27 | private int getCounter=0; 28 | public SearchOrder(int size) 29 | { 30 | order= new int[size]; 31 | for (int i = 0; i < size; i++) 32 | { 33 | order[i]=-1; 34 | } 35 | } 36 | 37 | public void addNext(int index) 38 | { 39 | if(addCounter>=order.length) 40 | { System.out.println("ERROR IN ADDING order!!"); return;} 41 | order[addCounter]=index; 42 | addCounter++; 43 | } 44 | 45 | public int getNext() 46 | { 47 | if(getCounter>=order.length) 48 | {return -1;} 49 | getCounter++; 50 | return order[getCounter-1]; 51 | } 52 | 53 | public void stepBack() 54 | { 55 | if(getCounter==0) 56 | return; 57 | getCounter--; 58 | } 59 | 60 | public void reset() 61 | { 62 | getCounter=1; 63 | } 64 | 65 | public int getSecondOrderValue(int index1, int index2) 66 | { 67 | int value1=-1,value2=-1; //value represents the search order 68 | for (int i = 0; i < order.length; i++) 69 | { 70 | if(order[i]==index1) 71 | value1=i; 72 | else if(order[i]==index2) 73 | value2=i; 74 | } 75 | 76 | if(value1>value2) 77 | return value1; 78 | else 79 | return value2; 80 | } 81 | public int getVariableIndex(int searchOrderIndex) 82 | { 83 | return order[searchOrderIndex]; 84 | } 85 | 86 | 87 | } 88 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | GraMi 2 | ===== 3 | 4 | GraMi is a novel framework for frequent subgraph mining in a single large graph, GraMi outperforms existing techniques by 2 orders of magnitudes. GraMi supports finding frequent subgraphs as well as frequent patterns, Compared to subgraphs, patterns offer a more powerful version of matching that captures transitive interactions between graph nodes (like friend of a friend) which are very common in modern applications. Also, GraMi supports user-defined structural and semantic constraints over the results, as well as approximate results. 5 | 6 | For more details, check our paper: Mohammed Elseidy, Ehab Abdelhamid, Spiros Skiadopoulos, and Panos Kalnis. "GRAMI: Frequent Subgraph and Pattern Mining in a Single Large Graph. PVLDB, 7(7):517-528, 2014." 7 | 8 | CONTENTS: 9 | ===== 10 | 11 | README ................... This file 12 | LICENSE.txt .............. License file (Open Source) 13 | build .................... build GraMi java binary files 14 | grami .................... script to run GraMi 15 | Datasets/ ................ Example graphs 16 | GRAMI_*/ ................. Directory containing GraMi sources 17 | 18 | 19 | REQUIREMENTS: 20 | ===== 21 | 22 | Java JRE v1.6.0 or later 23 | 24 | INSTALLATION: 25 | ===== 26 | 27 | - Uncompress grami using any compression tool 28 | - Build Java binaries using the "build" script file 29 | - Run GraMi using "grami" script 30 | 31 | EXAMPLES: 32 | ===== 33 | 34 | 1- Show GraMi breif help: "./grami -h" 35 | 2- Find frequent subgraphs in the "mico" undirected graph, with minimum frequency = 14000: "./grami -f mico.lg -s 14000 -t 0 -p 0" 36 | 3- Find frequent subgraphs in the "mico" undirected graph, with minimum frequency = 9340 and approximation: "./grami -f mico.lg -s 9340 -t 0 -p 0 -approxA 0.0002 -approxB=0" 37 | 4- Find frequent patterns in the "citeseer" directed graph, with minimum frequency = 160 and maximum distance bound (edge weight) = 200: "./grami -f citeseer.lg -s 160 -t 1 -p 1 -d 200" 38 | 39 | Contributors 40 | ===== 41 | 42 | @Ehab-abdelhamid 43 | @ElSeidy 44 | 45 | 46 | Grami On Amazon AWS 47 | ===== 48 | http://cloud.kaust.edu.sa/Pages/Grami.aspx 49 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/dataStructures/Query.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package dataStructures; 21 | 22 | import java.util.ArrayList; 23 | 24 | public class Query 25 | { 26 | private HPListGraph listGraph; 27 | 28 | public Query(Graph g) { 29 | listGraph=g.getListGraph(); 30 | } 31 | 32 | public Query(HPListGraph lsGraph) { 33 | listGraph=lsGraph; 34 | } 35 | 36 | 37 | 38 | public HPListGraph getListGraph() { 39 | return listGraph; 40 | } 41 | 42 | 43 | public ArrayList getConnectedLabels() 44 | { 45 | ArrayList cls = new ArrayList(); 46 | 47 | HPListGraph hp = listGraph; 48 | for (int edge = hp.getEdges().nextSetBit(0); edge >= 0; edge = hp.getEdges().nextSetBit(edge + 1)) 49 | { 50 | int nodeA,nodeB,labelA,labelB; 51 | 52 | if(hp.getDirection(edge)>=0) 53 | { 54 | nodeA= hp.getNodeA(edge); labelA=hp.getNodeLabel(nodeA); 55 | nodeB = hp.getNodeB(edge);labelB=hp.getNodeLabel(nodeB); 56 | } 57 | else 58 | { 59 | nodeB= hp.getNodeA(edge); labelB=hp.getNodeLabel(nodeB); 60 | nodeA = hp.getNodeB(edge);labelA=hp.getNodeLabel(nodeA); 61 | } 62 | 63 | 64 | ConnectedComponent cl = new ConnectedComponent(nodeA,labelA, nodeB,labelB, Double.parseDouble(listGraph.getEdgeLabel(nodeA, nodeB)+"")); 65 | cls.add(cl); 66 | } 67 | return cls; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/temp/Reminder.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package temp; 21 | 22 | import java.util.Timer; 23 | import java.util.TimerTask; 24 | 25 | public class Reminder { 26 | Timer timer; 27 | application app; 28 | 29 | public Reminder(int seconds) { 30 | 31 | app = new application(); 32 | app.start(); 33 | timer = new Timer(true); 34 | timer.schedule(new RemindTask(), seconds*1000); 35 | 36 | 37 | } 38 | 39 | class RemindTask extends TimerTask { 40 | public void run() { 41 | System.out.format("Time's up!%n"); 42 | 43 | System.out.println(app.isAlive()); 44 | app.stopIT(); 45 | System.out.println(app.isAlive()); 46 | //timer.cancel(); 47 | } 48 | } 49 | class application extends Thread { 50 | volatile boolean stop=false; 51 | public void run() { 52 | 53 | int counter=0; 54 | //x=1; 55 | while (!stop) 56 | { 57 | //System.out.println(counter++); 58 | } 59 | System.out.println("stopped"); 60 | } 61 | 62 | public void stopIT() 63 | { 64 | stop=true; 65 | } 66 | 67 | } 68 | 69 | 70 | 71 | public static void main(String args[]) { 72 | new Reminder(7); 73 | System.out.format("Task scheduled.%n"); 74 | } 75 | } -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/search/GenerationPartialStep.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 25, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package search; 16 | 17 | 18 | /** 19 | * This class defines the functionality of a single step during the generation 20 | * of extensions for the mining process 21 | * 22 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 23 | * 24 | * @param 25 | * the type of the node labels (will be hashed and checked with 26 | * .equals(..)) 27 | * @param 28 | * the type of the edge labels (will be hashed and checked with 29 | * .equals(..)) 30 | */ 31 | public abstract class GenerationPartialStep extends 32 | MiningStep { 33 | 34 | /** 35 | * creates a new step, that will use the 36 | * next MiningStep, if necessary 37 | * @param next 38 | */ 39 | public GenerationPartialStep(final MiningStep next) { 40 | super(next); 41 | } 42 | 43 | public abstract void call(SearchLatticeNode node); 44 | 45 | protected final void callNext( 46 | final SearchLatticeNode node) { 47 | @SuppressWarnings("unchecked") 48 | final GenerationPartialStep gen = (GenerationPartialStep) next; 49 | if (gen != null) { 50 | gen.call(node); 51 | } 52 | } 53 | 54 | /** 55 | * tells this step that the extensions for the next node will be searched 56 | * furthermore 57 | */ 58 | public void reset() { 59 | resetNext(); 60 | } 61 | 62 | /** 63 | * resets the next step 64 | */ 65 | protected final void resetNext() { 66 | @SuppressWarnings("unchecked") 67 | final GenerationPartialStep gen = (GenerationPartialStep) next; 68 | if (next != null) { 69 | gen.reset(); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/dataStructures/Query.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package dataStructures; 21 | 22 | import java.util.ArrayList; 23 | 24 | public class Query 25 | { 26 | //private Graph graph; 27 | private HPListGraph listGraph; 28 | 29 | public Query(Graph g) { 30 | listGraph=g.getListGraph(); 31 | } 32 | 33 | public Query(HPListGraph lsGraph) { 34 | listGraph=lsGraph; 35 | } 36 | 37 | 38 | 39 | public HPListGraph getListGraph() { 40 | return listGraph; 41 | } 42 | 43 | 44 | public ArrayList getConnectedLabels() 45 | { 46 | ArrayList cls = new ArrayList(); 47 | 48 | HPListGraph hp = listGraph; 49 | for (int edge = hp.getEdges().nextSetBit(0); edge >= 0; edge = hp.getEdges().nextSetBit(edge + 1)) 50 | { 51 | int nodeA,nodeB,labelA,labelB; 52 | 53 | if(hp.getDirection(edge)>=0) 54 | { 55 | nodeA= hp.getNodeA(edge); labelA=hp.getNodeLabel(nodeA); 56 | nodeB = hp.getNodeB(edge);labelB=hp.getNodeLabel(nodeB); 57 | } 58 | else 59 | { 60 | nodeB= hp.getNodeA(edge); labelB=hp.getNodeLabel(nodeB); 61 | nodeA = hp.getNodeB(edge);labelA=hp.getNodeLabel(nodeA); 62 | } 63 | 64 | ConnectedComponent cl = new ConnectedComponent(nodeA,labelA, nodeB,labelB, Double.parseDouble(listGraph.getEdgeLabel(nodeA, nodeB)+"")); 65 | cls.add(cl); 66 | } 67 | return cls; 68 | } 69 | 70 | 71 | 72 | } 73 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/dataStructures/Node.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 2, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | import java.util.Iterator; 18 | 19 | 20 | /** 21 | * Declares the functionality of a graph Node. 22 | * 23 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 24 | * 25 | * @param 26 | * the type of the node labels (will be hashed and checked with 27 | * .equals(..)) 28 | * @param 29 | * the type of the edge labels (will be hashed and checked with 30 | * .equals(..)) 31 | */ 32 | public interface Node extends Generic { 33 | 34 | /** 35 | * @return an iterator over all connected edges (undirected, outgoing, and 36 | * incoming) 37 | */ 38 | public Iterator> edgeIterator(); 39 | 40 | /** 41 | * @return the number of all connected edges (undirected, outgoing, and 42 | * incomming) 43 | */ 44 | public int getDegree(); 45 | 46 | 47 | /** 48 | * @return the number of all incoming edges 49 | */ 50 | public int getInDegree(); 51 | 52 | /** 53 | * @return the node index of this node in the correponding graph 54 | */ 55 | public int getIndex(); 56 | 57 | /** 58 | * @return the connected label 59 | */ 60 | public NodeType getLabel(); 61 | 62 | /** 63 | * @return the number of all outgoing edges 64 | */ 65 | public int getOutDegree(); 66 | 67 | /** 68 | * @return an iterator over all incoming edges 69 | */ 70 | public Iterator> incommingEdgeIterator(); 71 | 72 | /** 73 | * @return an iterator over all outcoming edges 74 | */ 75 | public Iterator> outgoingEdgeIterator(); 76 | 77 | /** 78 | * set the label of this edge 79 | * 80 | * @param label 81 | */ 82 | public void setLabel(NodeType label); 83 | 84 | } 85 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/dataStructures/Node.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 2, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | import java.util.Iterator; 18 | 19 | 20 | /** 21 | * Declares the functionality of a graph Node. 22 | * 23 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 24 | * 25 | * @param 26 | * the type of the node labels (will be hashed and checked with 27 | * .equals(..)) 28 | * @param 29 | * the type of the edge labels (will be hashed and checked with 30 | * .equals(..)) 31 | */ 32 | public interface Node extends Generic { 33 | 34 | /** 35 | * @return an iterator over all connected edges (undirected, outgoing, and 36 | * incoming) 37 | */ 38 | public Iterator> edgeIterator(); 39 | 40 | /** 41 | * @return the number of all connected edges (undirected, outgoing, and 42 | * incomming) 43 | */ 44 | public int getDegree(); 45 | 46 | 47 | /** 48 | * @return the number of all incoming edges 49 | */ 50 | public int getInDegree(); 51 | 52 | /** 53 | * @return the node index of this node in the correponding graph 54 | */ 55 | public int getIndex(); 56 | 57 | /** 58 | * @return the connected label 59 | */ 60 | public NodeType getLabel(); 61 | 62 | /** 63 | * @return the number of all outgoing edges 64 | */ 65 | public int getOutDegree(); 66 | 67 | /** 68 | * @return an iterator over all incoming edges 69 | */ 70 | public Iterator> incommingEdgeIterator(); 71 | 72 | /** 73 | * @return an iterator over all outcoming edges 74 | */ 75 | public Iterator> outgoingEdgeIterator(); 76 | 77 | /** 78 | * set the label of this edge 79 | * 80 | * @param label 81 | */ 82 | public void setLabel(NodeType label); 83 | 84 | } 85 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/dataStructures/Node.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 2, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | import java.util.Iterator; 18 | 19 | 20 | /** 21 | * Declares the functionality of a graph Node. 22 | * 23 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 24 | * 25 | * @param 26 | * the type of the node labels (will be hashed and checked with 27 | * .equals(..)) 28 | * @param 29 | * the type of the edge labels (will be hashed and checked with 30 | * .equals(..)) 31 | */ 32 | public interface Node extends Generic { 33 | 34 | /** 35 | * @return an iterator over all connected edges (undirected, outgoing, and 36 | * incoming) 37 | */ 38 | public Iterator> edgeIterator(); 39 | 40 | /** 41 | * @return the number of all connected edges (undirected, outgoing, and 42 | * incomming) 43 | */ 44 | public int getDegree(); 45 | 46 | 47 | /** 48 | * @return the number of all incoming edges 49 | */ 50 | public int getInDegree(); 51 | 52 | /** 53 | * @return the node index of this node in the correponding graph 54 | */ 55 | public int getIndex(); 56 | 57 | /** 58 | * @return the connected label 59 | */ 60 | public NodeType getLabel(); 61 | 62 | /** 63 | * @return the number of all outgoing edges 64 | */ 65 | public int getOutDegree(); 66 | 67 | /** 68 | * @return an iterator over all incoming edges 69 | */ 70 | public Iterator> incommingEdgeIterator(); 71 | 72 | /** 73 | * @return an iterator over all outcoming edges 74 | */ 75 | public Iterator> outgoingEdgeIterator(); 76 | 77 | /** 78 | * set the label of this edge 79 | * 80 | * @param label 81 | */ 82 | public void setLabel(NodeType label); 83 | 84 | } 85 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_PATTERNS/src/search/FrequencyPruningStep.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 25, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package search; 16 | 17 | import java.util.Collection; 18 | 19 | import dataStructures.Extension; 20 | import dataStructures.Frequency; 21 | import dataStructures.Frequented; 22 | 23 | 24 | /** 25 | * This class implements the general pruning of fragments according to their 26 | * frequency. 27 | * 28 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 29 | * 30 | * @param 31 | * the type of the node labels (will be hashed and checked with 32 | * .equals(..)) 33 | * @param 34 | * the type of the edge labels (will be hashed and checked with 35 | * .equals(..)) 36 | */ 37 | public class FrequencyPruningStep extends 38 | MiningStep { 39 | 40 | private final Frequency min, max; 41 | 42 | /** 43 | * creates a new frequency pruning 44 | * 45 | * @param next 46 | * @param min 47 | * @param max 48 | */ 49 | public FrequencyPruningStep(final MiningStep next, 50 | final Frequency min, final Frequency max) { 51 | super(next); 52 | this.min = min; 53 | this.max = max; 54 | } 55 | 56 | /* 57 | * (non-Javadoc) 58 | * 59 | * @see de.parsemis.miner.MiningStep#call(de.parsemis.miner.SearchLatticeNode, 60 | * java.util.Collection) 61 | */ 62 | @Override 63 | public void call(final SearchLatticeNode node, 64 | final Collection> extensions) { 65 | final Frequency freq = ((Frequented) node).frequency(); //HERE THE FREQUENCY CALCULATION OCCURS !!! 66 | if (max != null && max.compareTo(freq) < 0) { 67 | node.store(false); 68 | } 69 | if (min.compareTo(freq) > 0) { 70 | node.store(false); 71 | } else { 72 | callNext(node, extensions); 73 | } 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/search/FrequencyPruningStep.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 25, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package search; 16 | 17 | import java.util.Collection; 18 | 19 | import dataStructures.Extension; 20 | import dataStructures.Frequency; 21 | import dataStructures.Frequented; 22 | 23 | 24 | /** 25 | * This class implements the general pruning of fragments according to their 26 | * frequency. 27 | * 28 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 29 | * 30 | * @param 31 | * the type of the node labels (will be hashed and checked with 32 | * .equals(..)) 33 | * @param 34 | * the type of the edge labels (will be hashed and checked with 35 | * .equals(..)) 36 | */ 37 | public class FrequencyPruningStep extends 38 | MiningStep { 39 | 40 | private final Frequency min, max; 41 | 42 | /** 43 | * creates a new frequency pruning 44 | * 45 | * @param next 46 | * @param min 47 | * @param max 48 | */ 49 | public FrequencyPruningStep(final MiningStep next, 50 | final Frequency min, final Frequency max) { 51 | super(next); 52 | this.min = min; 53 | this.max = max; 54 | } 55 | 56 | /* 57 | * (non-Javadoc) 58 | * 59 | * @see de.parsemis.miner.MiningStep#call(de.parsemis.miner.SearchLatticeNode, 60 | * java.util.Collection) 61 | */ 62 | @Override 63 | public void call(final SearchLatticeNode node, 64 | final Collection> extensions) { 65 | final Frequency freq = ((Frequented) node).frequency(); //HERE THE FREQUENCY CALCULATION OCCURS !!! 66 | if (max != null && max.compareTo(freq) < 0) { 67 | node.store(false); 68 | } 69 | if (min.compareTo(freq) > 0) { 70 | node.store(false); 71 | } else { 72 | callNext(node, extensions); 73 | } 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/search/FrequencyPruningStep.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 25, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package search; 16 | 17 | import java.util.Collection; 18 | 19 | import dataStructures.Extension; 20 | import dataStructures.Frequency; 21 | import dataStructures.Frequented; 22 | 23 | 24 | /** 25 | * This class implements the general pruning of fragments according to their 26 | * frequency. 27 | * 28 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 29 | * 30 | * @param 31 | * the type of the node labels (will be hashed and checked with 32 | * .equals(..)) 33 | * @param 34 | * the type of the edge labels (will be hashed and checked with 35 | * .equals(..)) 36 | */ 37 | public class FrequencyPruningStep extends 38 | MiningStep { 39 | 40 | private final Frequency min, max; 41 | 42 | /** 43 | * creates a new frequency pruning 44 | * 45 | * @param next 46 | * @param min 47 | * @param max 48 | */ 49 | public FrequencyPruningStep(final MiningStep next, 50 | final Frequency min, final Frequency max) { 51 | super(next); 52 | this.min = min; 53 | this.max = max; 54 | } 55 | 56 | /* 57 | * (non-Javadoc) 58 | * 59 | * @see de.parsemis.miner.MiningStep#call(de.parsemis.miner.SearchLatticeNode, 60 | * java.util.Collection) 61 | */ 62 | @Override 63 | public void call(final SearchLatticeNode node, 64 | final Collection> extensions) { 65 | final Frequency freq = ((Frequented) node).frequency(); //HERE THE FREQUENCY CALCULATION OCCURS !!! 66 | if (max != null && max.compareTo(freq) < 0) { 67 | node.store(false); 68 | } 69 | if (min.compareTo(freq) > 0) { 70 | node.store(false); 71 | } else { 72 | callNext(node, extensions); 73 | } 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/dataStructures/Node.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 2, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package dataStructures; 16 | 17 | import java.util.Iterator; 18 | 19 | 20 | /** 21 | * Declares the functionality of a graph Node. 22 | * 23 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 24 | * 25 | * @param 26 | * the type of the node labels (will be hashed and checked with 27 | * .equals(..)) 28 | * @param 29 | * the type of the edge labels (will be hashed and checked with 30 | * .equals(..)) 31 | */ 32 | public interface Node extends Generic { 33 | 34 | /** 35 | * @return an iterator over all connected edges (undirected, outgoing, and 36 | * incoming) 37 | */ 38 | public Iterator> edgeIterator(); 39 | 40 | /** 41 | * @return the number of all connected edges (undirected, outgoing, and 42 | * incomming) 43 | */ 44 | public int getDegree(); 45 | 46 | 47 | /** 48 | * @return the number of all incoming edges 49 | */ 50 | public int getInDegree(); 51 | 52 | /** 53 | * @return the node index of this node in the correponding graph 54 | */ 55 | public int getIndex(); 56 | 57 | /** 58 | * @return the connected label 59 | */ 60 | public NodeType getLabel(); 61 | 62 | /** 63 | * @return the number of all outgoing edges 64 | */ 65 | public int getOutDegree(); 66 | 67 | /** 68 | * @return an iterator over all incoming edges 69 | */ 70 | public Iterator> incommingEdgeIterator(); 71 | 72 | /** 73 | * @return an iterator over all outcoming edges 74 | */ 75 | public Iterator> outgoingEdgeIterator(); 76 | 77 | /** 78 | * set the label of this edge 79 | * 80 | * @param label 81 | */ 82 | public void setLabel(NodeType label); 83 | 84 | } 85 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/search/FrequencyPruningStep.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 25, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package search; 16 | 17 | import java.util.Collection; 18 | 19 | import dataStructures.Extension; 20 | import dataStructures.Frequency; 21 | import dataStructures.Frequented; 22 | 23 | 24 | /** 25 | * This class implements the general pruning of fragments according to their 26 | * frequency. 27 | * 28 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 29 | * 30 | * @param 31 | * the type of the node labels (will be hashed and checked with 32 | * .equals(..)) 33 | * @param 34 | * the type of the edge labels (will be hashed and checked with 35 | * .equals(..)) 36 | */ 37 | public class FrequencyPruningStep extends 38 | MiningStep { 39 | 40 | private final Frequency min, max; 41 | 42 | /** 43 | * creates a new frequency pruning 44 | * 45 | * @param next 46 | * @param min 47 | * @param max 48 | */ 49 | public FrequencyPruningStep(final MiningStep next, 50 | final Frequency min, final Frequency max) { 51 | super(next); 52 | this.min = min; 53 | this.max = max; 54 | } 55 | 56 | /* 57 | * (non-Javadoc) 58 | * 59 | * @see de.parsemis.miner.MiningStep#call(de.parsemis.miner.SearchLatticeNode, 60 | * java.util.Collection) 61 | */ 62 | @Override 63 | public void call(final SearchLatticeNode node, 64 | final Collection> extensions) { 65 | final Frequency freq = ((Frequented) node).frequency(); //HERE THE FREQUENCY CALCULATION OCCURS !!! 66 | if (max != null && max.compareTo(freq) < 0) { 67 | node.store(false); 68 | } 69 | if (min.compareTo(freq) > 0) { 70 | node.store(false); 71 | } else { 72 | callNext(node, extensions); 73 | } 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /GRAMI_DIRECTED_SUBGRAPHS/src/AlgorithmInterface/Algorithm.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 2, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package AlgorithmInterface; 16 | 17 | import java.io.Serializable; 18 | import java.util.Collection; 19 | import java.util.Iterator; 20 | 21 | import search.Extender; 22 | import search.Generic; 23 | import search.SearchLatticeNode; 24 | 25 | /** 26 | * This interface encapsulate the required abilities of a mining algorithm. 27 | * 28 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 29 | * 30 | * @param 31 | * the type of the node labels (will be hashed and checked with 32 | * .equals(..)) 33 | * @param 34 | * the type of the edge labels (will be hashed and checked with 35 | * .equals(..)) 36 | */ 37 | public interface Algorithm extends 38 | Generic, Serializable { 39 | 40 | /** 41 | * @param threadIdx 42 | * @return a (new) Extender Object for the given thread (index) 43 | */ 44 | public Extender getExtender(int minFreq); 45 | 46 | /** 47 | * Initialize the algorithm 48 | * 49 | * @param graphs 50 | * the set of graphs that will be search for frequent fragments 51 | * @param factory 52 | * the factory new graphs will be created with 53 | * @param settings 54 | * the settings for the search 55 | * @return a collection with all fragments that will not be found by the 56 | * algorithm 57 | */ 58 | // public Collection> initialize( 59 | // final Collection> graphs, 60 | // final GraphFactory factory, 61 | // final Settings settings); 62 | 63 | /** 64 | * @return an iterator over the initial nodes for the search 65 | */ 66 | public Iterator> initialNodes(); 67 | 68 | } 69 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/AlgorithmInterface/Algorithm.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 2, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package AlgorithmInterface; 16 | 17 | import java.io.Serializable; 18 | import java.util.Collection; 19 | import java.util.Iterator; 20 | 21 | import search.Extender; 22 | import search.Generic; 23 | import search.SearchLatticeNode; 24 | 25 | /** 26 | * This interface encapsulate the required abilities of a mining algorithm. 27 | * 28 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 29 | * 30 | * @param 31 | * the type of the node labels (will be hashed and checked with 32 | * .equals(..)) 33 | * @param 34 | * the type of the edge labels (will be hashed and checked with 35 | * .equals(..)) 36 | */ 37 | public interface Algorithm extends 38 | Generic, Serializable { 39 | 40 | /** 41 | * @param threadIdx 42 | * @return a (new) Extender Object for the given thread (index) 43 | */ 44 | public Extender getExtender(int minFreq); 45 | 46 | /** 47 | * Initialize the algorithm 48 | * 49 | * @param graphs 50 | * the set of graphs that will be search for frequent fragments 51 | * @param factory 52 | * the factory new graphs will be created with 53 | * @param settings 54 | * the settings for the search 55 | * @return a collection with all fragments that will not be found by the 56 | * algorithm 57 | */ 58 | // public Collection> initialize( 59 | // final Collection> graphs, 60 | // final GraphFactory factory, 61 | // final Settings settings); 62 | 63 | /** 64 | * @return an iterator over the initial nodes for the search 65 | */ 66 | public Iterator> initialNodes(); 67 | 68 | } 69 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_SUBGRAPHS/src/AlgorithmInterface/Algorithm.java: -------------------------------------------------------------------------------- 1 | /** 2 | * created May 2, 2006 3 | * 4 | * @by Marc Woerlein (woerlein@informatik.uni-erlangen.de) 5 | * 6 | * Copyright 2006 Marc Woerlein 7 | * 8 | * This file is part of parsemis. 9 | * 10 | * Licence: 11 | * LGPL: http://www.gnu.org/licenses/lgpl.html 12 | * EPL: http://www.eclipse.org/org/documents/epl-v10.php 13 | * See the LICENSE file in the project's top-level directory for details. 14 | */ 15 | package AlgorithmInterface; 16 | 17 | import java.io.Serializable; 18 | import java.util.Collection; 19 | import java.util.Iterator; 20 | 21 | import search.Extender; 22 | import search.Generic; 23 | import search.SearchLatticeNode; 24 | 25 | /** 26 | * This interface encapsulate the required abilities of a mining algorithm. 27 | * 28 | * @author Marc Woerlein (woerlein@informatik.uni-erlangen.de) 29 | * 30 | * @param 31 | * the type of the node labels (will be hashed and checked with 32 | * .equals(..)) 33 | * @param 34 | * the type of the edge labels (will be hashed and checked with 35 | * .equals(..)) 36 | */ 37 | public interface Algorithm extends 38 | Generic, Serializable { 39 | 40 | /** 41 | * @param threadIdx 42 | * @return a (new) Extender Object for the given thread (index) 43 | */ 44 | public Extender getExtender(int minFreq); 45 | 46 | /** 47 | * Initialize the algorithm 48 | * 49 | * @param graphs 50 | * the set of graphs that will be search for frequent fragments 51 | * @param factory 52 | * the factory new graphs will be created with 53 | * @param settings 54 | * the settings for the search 55 | * @return a collection with all fragments that will not be found by the 56 | * algorithm 57 | */ 58 | // public Collection> initialize( 59 | // final Collection> graphs, 60 | // final GraphFactory factory, 61 | // final Settings settings); 62 | 63 | /** 64 | * @return an iterator over the initial nodes for the search 65 | */ 66 | public Iterator> initialNodes(); 67 | 68 | } 69 | -------------------------------------------------------------------------------- /GRAMI_UNDIRECTED_PATTERNS/src/utilities/StopWatch.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2014 Mohammed Elseidy, Ehab Abdelhamid 3 | 4 | This file is part of Grami. 5 | 6 | Grami is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 2 of the License, or 9 | (at your option) any later version. 10 | 11 | Grami is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with Grami. If not, see . 18 | */ 19 | 20 | package utilities; 21 | 22 | public class StopWatch { 23 | 24 | private long startTime = 0; 25 | private long stopTime = 0; 26 | private boolean running = false; 27 | 28 | 29 | public void start() { 30 | this.startTime = System.currentTimeMillis(); 31 | this.running = true; 32 | } 33 | 34 | 35 | public void stop() { 36 | this.stopTime = System.currentTimeMillis(); 37 | this.running = false; 38 | } 39 | 40 | 41 | //elaspsed time in milliseconds 42 | public long getElapsedTime() { 43 | long elapsed; 44 | if (running) { 45 | elapsed = (System.currentTimeMillis() - startTime); 46 | } 47 | else { 48 | elapsed = (stopTime - startTime); 49 | } 50 | return elapsed; 51 | } 52 | 53 | 54 | //elaspsed time in seconds 55 | public long getElapsedTimeSecs() { 56 | long elapsed; 57 | if (running) { 58 | elapsed = ((System.currentTimeMillis() - startTime) / 1000); 59 | } 60 | else { 61 | elapsed = ((stopTime - startTime) / 1000); 62 | } 63 | return elapsed; 64 | } 65 | 66 | //sample usage 67 | public static void main(String[] args) { 68 | StopWatch s = new StopWatch(); 69 | s.start(); 70 | //code you want to time goes here 71 | s.stop(); 72 | System.out.println("elapsed time in milliseconds: " + s.getElapsedTime()); 73 | } 74 | } 75 | --------------------------------------------------------------------------------