diff --git a/PAMI/subgraphMining/basic/gspan.py b/PAMI/subgraphMining/basic/gspan.py index e1c6dc70..2c26c5e3 100644 --- a/PAMI/subgraphMining/basic/gspan.py +++ b/PAMI/subgraphMining/basic/gspan.py @@ -649,4 +649,17 @@ def getFrequentSubgraphs(self): sb.append('\n'.join(subgraphDescription)) return '\n'.join(sb) + def getSubgraphGraphMapping(self): + """ + Return a list of mappings from subgraphs to the graph IDs they belong to in the format . + """ + mappings = [] + for i, subgraph in enumerate(self.frequentSubgraphs): + mapping = { + "FID": i, + "Clabel": str(subgraph.dfsCode), + "GIDs": list(subgraph.setOfGraphsIds) + } + mappings.append(mapping) + return mappings diff --git a/PAMI/subgraphMining/topK/graph.py b/PAMI/subgraphMining/topK/graph.py index 473fb76f..01bce433 100644 --- a/PAMI/subgraphMining/topK/graph.py +++ b/PAMI/subgraphMining/topK/graph.py @@ -44,7 +44,7 @@ def removeInfrequentLabel(self, label): for vertex in self.vMap.values(): edgesToRemove = [edge for edge in vertex.getEdgeList() - if edge.getV1() not in self.vMap or edge.getV2() not in self.vMap] + if edge.v1 not in self.vMap or edge.v2 not in self.vMap] for edge in edgesToRemove: vertex.getEdgeList().remove(edge) diff --git a/PAMI/subgraphMining/topK/tkg.py b/PAMI/subgraphMining/topK/tkg.py index b93e94cf..4eeab189 100644 --- a/PAMI/subgraphMining/topK/tkg.py +++ b/PAMI/subgraphMining/topK/tkg.py @@ -492,7 +492,7 @@ def removeInfrequentVertexPairs(self, graphDB): if TKG.ELIMINATE_INFREQUENT_VERTEX_PAIRS and count < self.minSup: v1.removeEdge(edge) - self.infrequentVertexPairsRemoved += 1 + self.infrequentVertexPairsRemovedCount += 1 elif TKG.ELIMINATE_INFREQUENT_EDGE_LABELS and \ mapEdgeLabelToSupport.get(edge.getEdgeLabel(), 0) < self.minSup: