jacquesfize / GMatch4py

A graph matching library for Python
MIT License
192 stars 41 forks source link

How to define substitution cost? #32

Open YenTran32 opened 2 years ago

YenTran32 commented 2 years ago

Hi.

I have a question about the substitution cost. When we define ged=gm.GraphEditDistance(1,1,1,1), I think that the parameters are equal to node_del,node_ins,edge_del,edge_ins. Is there a way to input user-defined substitution cost matrix (e.g., a cost of 1 for a mis-match between two edges A and B, and a cost of 0 if two edges are identical)? Or the substitution costs are computed automatically?

Thank you.

Tran.

jacquesfize commented 1 year ago

Hi,

You can create a new class in the gmatch4py.ged module that inherit from AbstractGraphEditDistance. In this new class, you can redefine all cost function with the methods : insert_cost(), delete_cost() and substitute_cost()

Best, Jacques

YenTran32 commented 1 year ago

Hi Jacques,

Thank you for the answer. I will try.

Tran.