From 8a90c9d408e28983432b5d4c667169f1c2180d6b Mon Sep 17 00:00:00 2001 From: Ishan Date: Wed, 22 May 2024 16:31:46 +0530 Subject: [PATCH 1/4] Added a map function to map graphs and subgraphs --- PAMI/subgraphMining/basic/gspan.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 From a101f7702c5e74825eef7dcc2bcf4e534c309da5 Mon Sep 17 00:00:00 2001 From: Ishan Date: Wed, 22 May 2024 20:46:42 +0530 Subject: [PATCH 2/4] Fixed issue --- PAMI/subgraphMining/topK/graph.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PAMI/subgraphMining/topK/graph.py b/PAMI/subgraphMining/topK/graph.py index 473fb76f..2c2139ae 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.gv2 not in self.vMap] for edge in edgesToRemove: vertex.getEdgeList().remove(edge) From cfb388a62882be3107389c65854c6e064df367b0 Mon Sep 17 00:00:00 2001 From: Ishan Date: Wed, 22 May 2024 20:47:14 +0530 Subject: [PATCH 3/4] Fixed issue --- PAMI/subgraphMining/topK/graph.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PAMI/subgraphMining/topK/graph.py b/PAMI/subgraphMining/topK/graph.py index 2c2139ae..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.v1 not in self.vMap or edge.gv2 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) From d451c91011486668e9f7a36868399a4e0c5fb040 Mon Sep 17 00:00:00 2001 From: Ishan Date: Thu, 23 May 2024 00:41:43 +0530 Subject: [PATCH 4/4] Fixed issues --- PAMI/subgraphMining/topK/tkg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: