GMatch4py icon indicating copy to clipboard operation
GMatch4py copied to clipboard

How to define substitution cost?

Open YenTran32 opened this issue 2 years ago • 2 comments

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.

YenTran32 avatar Aug 23 '22 06:08 YenTran32

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

jacquesfize avatar Nov 18 '22 09:11 jacquesfize

Hi Jacques,

Thank you for the answer. I will try.

Tran.

YenTran32 avatar Nov 21 '22 07:11 YenTran32