Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issues of tkg and added new method to gspan #418

Merged
merged 6 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions PAMI/subgraphMining/basic/gspan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <FID, Clabel, GIDs[]>.
"""
mappings = []
for i, subgraph in enumerate(self.frequentSubgraphs):
mapping = {
"FID": i,
"Clabel": str(subgraph.dfsCode),
"GIDs": list(subgraph.setOfGraphsIds)
}
mappings.append(mapping)
return mappings

2 changes: 1 addition & 1 deletion PAMI/subgraphMining/topK/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion PAMI/subgraphMining/topK/tkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down