Example 3

Example for NEST graph measures using custom weighting #

nestgraph_custom_weight_example

Control flow edge class items weight are set to 2.0 and default weight for each graph item class are set to 1.0. Similarity computation between query object and case object are based on similarity measure, herer its “CustomAStar”. Custom weight for Loop start node and end node are not mentioned, hence it accept default value of 1.0.

In the beginnning, the graph item objects (of both query and case) weight are normalized. Then it filter out items with weight of 0.0, which are excluded from further calculation.

Here \(NW_{loopNode} = \frac{1}{1_{a} + 1_{b} + 2_{a->b} + 2_{b->a}} \) = 0.16666

\(NW_{ControlFlowEdge} = \frac{2}{1_{a} + 1_{b} + 2_{a->b} + 2_{b->a}} \) = 0.3333

Comparing the similarity of query with case, identical items are: loop start node, loop end node and one of edge connecting the nodes. Hence the following computation results the similarity measure:

sim = 0.1666 + 0.1666 + 0.333 = 0.666

Additional examples:

nestgraph_custom_weight_example
nestgraph_custom_weight_example
nestgraph_custom_weight_example
nestgraph_custom_weight_example
nestgraph_custom_weight_example
nestgraph_custom_weight_example
nestgraph_custom_weight_example