Skip to content

Commit

Permalink
Merge pull request #13 from cgoliver/master
Browse files Browse the repository at this point in the history
use node index instead of ID in alignment matrix
  • Loading branch information
qema authored Mar 28, 2021
2 parents d6ad4da + f545a91 commit 4d074cb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions subgraph_matching/alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ def gen_alignment_matrix(model, query, target, method_type="order"):
"""

mat = np.zeros((len(query), len(target)))
for u in query.nodes:
for v in target.nodes:
for i, u in enumerate(query.nodes):
for j, v in enumerate(target.nodes):
batch = utils.batch_nx_graphs([query, target], anchors=[u, v])
embs = model.emb_model(batch)
pred = model(embs[1].unsqueeze(0), embs[0].unsqueeze(0))
Expand All @@ -58,7 +58,7 @@ def gen_alignment_matrix(model, query, target, method_type="order"):
raw_pred = torch.log(raw_pred)
elif method_type == "mlp":
raw_pred = raw_pred[0][1]
mat[u][v] = raw_pred.item()
mat[i][j] = raw_pred.item()
return mat

def main():
Expand Down

0 comments on commit 4d074cb

Please sign in to comment.