Pattern Recognition Letters 116 (2018) 58–64
Contents lists available at ScienceDirect
Pattern Recognition Letters journal homepage: www.elsevier.com/locate/patrec
Error-tolerant graph matching using node contraction Shri Prakash Dwivedi∗, Ravi Shankar Singh Department of Computer Science & Engineering, Indian Institute of Technology (BHU), Varanasi, India
a r t i c l e
i n f o
Article history: Received 20 January 2018 Available online 11 September 2018 Keywords: Graph matching Graph edit distance Structural pattern recognition
a b s t r a c t Graph matching is the task of computing the similarity between two graphs. It is widely used in graphbased structural pattern recognition. Error-tolerant graph matching is a type of graph matching, in which a similarity between two graphs is computed based on some tolerance value whereas in exact graph matching a strict one-to-one correspondence is required between two graphs. In this paper, we present an approach to error-tolerant graph matching using node contraction where the given graph is transformed into another graph by contracting smaller degree nodes. We use this scheme to extend the notion of graph edit distance, which can be used as a trade-off between execution time and accuracy requirements of various graph matching applications. © 2018 Elsevier B.V. All rights reserved.
1. Introduction The graph is one of the most widely used discrete mathematical structure in computer science. Graph Matching (GM) is the task of finding the structural similarity between two graphs. The GM can be used to identify a correspondence between nodes and edges of two graphs. It has been an active area of research in computer science since past several decades. The GM has a wide range of applications in pattern recognition, computer vision, biometric, biological and bio-medical applications among others [1]. GM can be broadly divided into two categories, exact GM and error-tolerant GM. In exact GM a one-to-one correspondence is required between nodes and edges of two graphs. Similar to graph isomorphism, in exact GM there should exist for each node and edge of the first graph a corresponding node and edge in the second graph which are adjacent to the same set of nodes [2]. Error-tolerant or inexact GM allow some tolerance to error or noise the can be used to demonstrate the closeness between two graphs in a broader perspective. In several real-world applications, a strict one-to-one correspondence may not be desirable, as due to the presence of noise or distortions the output graph may get slightly deformed [3]. Error-tolerant GM is also known as errorcorrecting GM because it can be used to accommodate errors, that may have been introduced due to the presence of noise or distortions during the processing of graph. Exact polynomial time algorithm for GM problem is not known. Subgraph isomorphism problem is NP-complete, whereas graph isomorphism problem is neither known to be in class P, nor in ∗
Corresponding author. E-mail address:
[email protected] (S.P. Dwivedi).
https://doi.org/10.1016/j.patrec.2018.09.014 0167-8655/© 2018 Elsevier B.V. All rights reserved.
NP-complete. Due to unavailability of efficient polynomial time solution, various approximation and suboptimal algorithms for exact and error-tolerant GM have been introduced recently [4]. A comprehensive survey of various GM techniques is given in [3] and [5]. A formal framework for error-tolerant GM is presented in [6]. Some of the earlier methods proposed for error-tolerant GM are based on tree-search using backtracking, where a heuristic function can be used to guide for the selection of the most promising node at a given level of search tree [7]. In [8] authors proposed error-tolerant GM for the attributed relational graph (ARG). A distance measure for ARG which consider the cost of recognition of nodes is presented in [9]. A novel class of GM methods is based on relaxation labeling [10]. In this technique, every node of the first graph is assigned a label such that it matches a node of the other graph [11]. Labeling of the nodes can further be improved during the successive iterations until we get the desired labeling [12,13]. This technique has been further extended in [14–16]. Another class of GM algorithms is based on the spectral method of algebraic graph theory [17]. The spectral method is based on the observation that adjacency matrix of graph remains unchanged during node rearrangement and therefore for similar graphs, adjacency matrix will have same eigendecomposition [18,19]. A class of GM methods using the artificial neural network is described in [20,21]. GM techniques based on Hopfield neural network to optimize an input energy criterion is given in [22]. The GM methods using neural self-organizing map are described in [23]. Genetic algorithm based GM techniques are given in [24]. Another class of GM algorithms based on graph kernel have been described in [2,25]. The main advantage of kernel method is that it allows us to apply statistical pattern recognition
S.P. Dwivedi, R.S. Singh / Pattern Recognition Letters 116 (2018) 58–64
techniques to graph domain. The important classes of graph kernel include diffusion kernel, convolution kernel, and random walk kernel [26,27]. Graph Edit Distance (GED) is one of the flexible and most widely used method for error-tolerant GM [9,28]. GED between two graphs is the minimum number of edit operations required to transform the first graph into the second one. It is the generalization of tree edit distance, which in turn is the generalization of string edit distance. Although GED is the promising approach to GM, its computation is much expensive. To make GED computationally more feasible, many approximation techniques based on local search, greedy approach, neighborhood search, etc. have been proposed [29,30]. Approximate GED computation based on bipartite GM is given in [31]. Several refinements of bipartite GED computation using various search strategies are proposed recently [32–34]. In [35] authors describe a recent survey of various applications of bipartite GED. A hypergraph matching for images retrieved from various sources using game theory is presented in [36]. In [37] authors proposed GM for geometric graphs in which every vertex has an associated coordinate using Monte Carlo tree search. In this paper, we introduce an approach to error-tolerant GM by extending the idea given in [38]. To compute homeomorphic GED between two graphs, authors use path contraction to eliminate nodes with degree two, while maintaining the homeomorphism of two graphs. In this paper, we use node contraction to transform the input graph by removing the smaller degree nodes followed by GED computation. This process of node contraction is different from node merging given in [39] where nodes are merged or split based on under or over-segmentation of image regions. The proposed algorithm can be categorized as a class of GM algorithms, which reduces the graph size by eliminating the less important nodes or edges based on some measure of relevance. This paper is organized as follows. Section 2, explains basic concepts and motivation. Section 3, presents extension to GED using node contraction and error-tolerant GM. Section 4, contains experimental evaluation and discussion and finally, Section 5, describes conclusion.
2. Basic concepts and motivation In this section, we review the basic definitions used in exact and error-tolerant GM. For a detailed discussion the reader is referred to the books on GM [1,4]. A graph G is defined as G = (V, E, μ, ν ), where V is the set of vertices or nodes, E is the set of edges or links, μ: V → LV is a function that allocates a node label alphabet lv ∈ LV to each vertex v ∈ V, ν : E → LE is a function that allocates an edge label alphabet le ∈ LE to each edge in E. Here, LV and LE are node label set and edge label set respectively. In this paper, we use Gi to represent (Vi , Ei , μi , ν i ). Let G1 and G2 be two graphs. A bijective mapping f : V1 ↔ V2 from G1 to G2 is called an error-tolerant GM, if V1 ⊆ V1 and V2 ⊆ V2 [6]. A chain of edit operations that convert a graph G1 into G2 is called an edit path between G1 and G2 . A common set of edit operations include insertions, deletions, and substitutions of vertices or edges. The notation → u is used to represent the insertion of a vertex u, u → represent deletion of vertex u, and u → v denotes substitution of a vertex u by vertex v. The GED between two graphs G1 and G2 is defined by
GED(G1 , G2 ) = min(e1 ,...,ek )∈ϕ (G1 ,G2 )
k i=1
c ( ei )
59
Fig. 1. Node contraction on the graph H.
Here ϕ (G1 , G2 ) indicates the set of edit distance paths converting G1 to G2 , and c(ei ) is the cost function associated with every edit operation ei . Homeomorphic GED between G1 and G2 is defined by Dwivedi and Singh [38]
HGED(G1 , G2 ) = GED(G1 , G2 )
= min(e1 ,...,ek )∈ϕ (G1 ,G2 )
k
c ( ei )
i=1
Where G1 and G2 are graphs computed from G1 and G2 , respectively by performing path contraction from each vertex, ϕ (G1 , G2 ) denotes the set of edit paths converting G1 into G2 , and c(ei ) is the cost function assigned to every edit operation ei . The importance of error-tolerant GM is based on the premise that it can be used to accommodate errors that may have been incurred in the input graph due to the presence of noise or distortions during the processing or retrieval steps. For a dense graph, if the distortion starts with the addition (or removal) of a node or an edge followed by successive additions (or removal) of nodes or edges, then to perform the GM it may be reasonable to ignore the smallest degree nodes, if we want to do the matching using as few number of nodes of graph as possible. As an example, suppose we have a graph G as shown in Fig. 1, and due to distortion or presence of noise, additional nodes (u, v, w) got added, shown to be connected with dotted edges in graph H. After removing or contracting the 1-degree, 2-degree and 3-degree nodes, we get the same graph as G. 3. Extended graph edit distance The idea behind the node contraction is to ignore the less important nodes in the graph before proceeding to the process of graph matching. One of the measures of importance or centrality of nodes in a graph is degree centrality. Considering the degree centrality as a node importance indicator, we ignore or delete the nodes starting from least degree nodes. By simply removing nodes from the graph will change the topology of the graph drastically. To use a middle path, where the topology of the graph does not get modified abruptly, we delete the nodes and its associated edges, only when this does not disconnects the graph. In other words, we remove the smaller degree nodes provided that the total number of connected components of the graph remains the same. Keeping
60
S.P. Dwivedi, R.S. Singh / Pattern Recognition Letters 116 (2018) 58–64
in mind the above point of view, we can extend the GED to ignore the smaller degree nodes. Definition 1. Node contraction of a node u in a graph G is simply the deletion of the node u and its associated links provided that the node u is not a cut vertex. Cut vertex is a vertex whose removal disconnects the graph. It is also called as cut point or articulation point. Definition 2. k-degree node contraction is the operation of performing the node contraction of all the nodes of degree k of a graph G. We use kNC(G) to denote k-degree node contraction on a graph G. Definition 3. k∗ -degree node contraction is the process of applying k-degree node contraction consecutively from one degree to k degree on a graph G. If we denote k∗ -degree node contraction on a graph G by k∗ − NC (G ) then k∗ − NC (G ) = kNC ((k − 1 )NC ((k − 2 )NC (. . . 1NC (G ) . . . ))). Definition 4. k-GED is the computation of GED between two graphs with k-degree node contraction performed on both graphs. For two graphs G1 and G2 , we have
k-GED(G1 , G2 ) = GED(kNC (G1 ), kNC (G2 )) For k = 2, k-GED generalizes to homeomorphic GED [38], when path contraction is performed so that all simple paths (u1 , . . . , un ) are replaced by (u1 , un ) where Deg(ui ) = 2 for i = 2 to n − 1. Definition 5. k∗ -GED is the computation of GED between two graphs with k-degree node contraction performed on both graphs starting from one-degree nodes to k degree nodes. Let G1 and G2 be two graphs, then
k -GED(G1 , G2 ) = ∗
GED(G1 , G2 ), if k = 0 GE D(k∗ -NC (G1 ), k∗ -NC (G2 )), if k ≥ 1
To make the effect of node contraction on graph topology more explicit, we define node deletion, as a standard removal of a node and its associated edges, regardless of whether or not it is a cut vertex. Similar to k-degree node contraction, k∗ -degree node contraction (k∗ -NC), k-GED and k∗ -GED, we define k-degree node deletion, k∗ -degree node deletion (k∗ -ND), k-ND-GED and k∗ -ND-GED respectively, where in each definition node contraction operation is replaced by node deletion. Here, we observe that |k∗ -ND(G)| ≤ |k∗ NC(G)|, where |G| denotes size or number of nodes in graph G. Since the removal of nodes in node deletion operation is unrestricted; therefore the number of nodes in a graph G after node deletion is less than or equal to that of the number of nodes after node contraction. 3.1. Extended edit cost To define the edit cost of k-GED, we can extend the edit cost of GED by adding c (u → ) = 0, whenever deg(u ) = k and u is not a cut vertex of the graph. k-GED uses Euclidean distance measure and assigns the constant cost to insertion, deletion and substitution of nodes and edges. Let G1 and G2 be two graphs, for all nodes u ∈ V1 , v ∈ V2 and for all edges e ∈ E1 , f ∈ E2 , we define the extended edit cost function as follows. c (u → ) = xnode c ( → v ) = xnode c (u → v ) = ynode .||μ1 (u ) − μ2 (v )|| c (e → ) = xedge c ( → f ) = xedge c (e → f ) = yedge .||ν1 (e ) − ν2 ( f )|| c (u → ) = 0, if deg(u ) = k and u is not a cut point
Here, c(u → ) denotes the cost of deletion of node u, c ( → v ) stands for the cost of insertion of node v, c(u → v) is the cost of substitution of node u by node v, c(e → ) denotes the cost of deletion of edge e, c( → f) is the cost of insertion of edge f, and xnode , ynode , xedge , yedge are non-negative constants. We observe that the above cost function satisfy the nonnegativity property, i.e., c(ei ) ≥ 0, for every node and edge edit operations ei along with the triangle inequality property of insertion, deletion and substitution of nodes and edges. 3.2. Algorithm In this section, we describe the algorithm to perform errortolerant GM using node contraction. The computation of k∗ -degree node contraction of an input graph is described in Algorithm 1. Algorithm 1 k∗ -Node-Contraction (G, k). Input: A graph G = (V, E, μ, ν ) and a parameter k Output: Transformed graph after applying k∗ -degree node contraction on G 1: for (i ← 1 to k ) do for each (u ∈ G ) do 2: if ((deg(u )==k )) then 3: u.visit ← 1 4: else 5: u.visit ← 0 6: end if 7: 8: end for for each (u ∈ G ) do 9: if ((u.visit==1 )&&(u is not cut vertex)) then 10: V ← V \ {u} 11: 12: E ← E \ {(u, v )|(u, v ) ∈ E, ∀v ∈ G} u.visit ← 0 13: end if 14: 15: end for 16: end for 17: return G The input to the k∗ -Node-Contraction algorithm is a graph G and a parameter k. The outer for loop of the algorithm in lines 1–16, iteratively perform k-degree node contraction from 1 to k. The for loop of the algorithm in lines 2–8, uses a boolean flag visit, which is set to 1 when the degree of a vertex of G is k else it is reset to 0. If the visit flag of a node is set to 1 and it is not a cut vertex, then the node and its associated edges are removed from G and visit flag is reset to 0 in the for loop of lines 9–15. Finally, the transformed graph G is returned in line 17. This algorithm can be considered as a preprocessing phase of the proposed error-tolerant GM framework. Proposition 1. k∗ -Node-Contraction algorithm computes k∗ -degree node contraction of G1 and G2 . We can observe that the for loop in lines 1–16 of the Algorithm 1, ensures that k-degree node contraction starts from i=1 to k. If loop in line 10, allow only those nodes to be removed, whose degree is k and it is not a cut vertex, whereas visit flag make sure that each vertex is considered only once for contraction. Proposition 2. k∗ -Node-Contraction algorithm executes in O(n) time. We can check whether a node is cut vertex in O(n), and therefore for loop in lines 9–15 takes O(n). For loop in lines 2–8 also take O(n) time, while the outer for loop in lines 1–16 executes k times. So the Algorithm 1 takes overall O(k.n), which is O(n) time. The k∗ -GED computation of two graphs is described in Algorithm 2. A brief description of the k∗ -Graph-Edit-Distance algorithm is as follows. The input to the algorithm is two graphs
S.P. Dwivedi, R.S. Singh / Pattern Recognition Letters 116 (2018) 58–64
Algorithm 2 k∗ -Graph-Edit-Distance (G1 , G2 ). Input: Two Graphs G1 , G2 , where Gi = (Vi , Ei , μi , νi ) for i = 1, 2where V1 = {u1 , . . ., un } and V2 = {v1 , . . ., vm } and a parameter k Output: A min. cost k∗ -GED between G1 and G2 // V1 = {u1 , . . ., un } 1: G1 ← k∗ -Node-Contraction(G1 , k ) // V2 = {v1 , . . ., vm } 2: G2 ← k∗ -Node-Contraction(G2 , k ) 3: S ← ∅ 4: for all (vi ∈ V2 ) do S ← S ∪ {u1 → vi } 5: 6: end for 7: S ← S ∪ {u1 → } 8: while (T rue ) do Prune S using heuristic methods 9: Compute Cmin the min. cost edit path from S 10: if (Cmin is a complete edit distance path) then 11: return Cmin 12: else 13: if (every node (ui ∈ V1 ) is processed) then 14: for every unprocessed (vj ∈ V2 ) do 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28:
Cmin ← Cmin ∪ { → vj } end for S ← S ∪ {Cmin } else for (each unprocessed node (ui ∈ V1 )) do for (every (vj ∈ V2 )) do
Cmin ← Cmin ∪ {ui → vj } ∪ {ui → } end for end for S ← S ∪ {Cmin } end if end if end while
unprocessed nodes of G1 in lines 20–24, and S is updated in line 25. Proposition 3. k∗ -Graph-Edit-Distance algorithm computes errortolerant GM of G1 and G2 . It follows from the properties of edit operations, i.e., addition, deletion and substitution of nodes and edges along with the definition of k∗ -GED. A complete edit path returned by Algorithm 2 ensures that each node of G1 is uniquely mapped to G2 , while Algorithm 1 makes sure that the modified vertex set V1 and V2 are subsets of V1 and V2 respectively. The worst case complexity of k∗ -Graph-Edit-Distance algorithm is exponential on the number of nodes in input graphs, but a suitable parameter k can be selected to reduce the overall execution time. Let us consider a tree-search based method implementation of k∗ -GraphEdit-Distance algorithm. At the first level of execution u1 is replaced by each of the vi for i = 1 to m , making it O(m ). Suppose substitution of u1 to v1 is selected at the first level, then during the next level u2 is again replaced by each of the vi for i = 2 to m , which is O(m ), making total time O(m 2 ) up to the second level. Similarly, at n th level, the worst-case execution time would become O(mn ). As discussed in Algorithm 2, a heuristic method like beam search can be used to reduce the average case execution time of algorithm at the cost of getting a suboptimal solution. To consider the effect of k on the size of the transformed graphs n and m . We observe that value of n and m is highly dependent on the topology and size of the input graphs. Let G(n, p) be a random graph, where n is the number of nodes and p is the probability of edges between each pair of vertices. Then the vertex degree distribution, is the number of vertices of degree k is given by which k (1 − p)n−k−1 . Now, we have the following loose relationpk = n−1 p k ship between n and n . Proposition 4. For a random graph G(n, p), the value of n and n as used in Algorithm 2 satisfy the following inequality
G1 , G2 , and a parameter k, and the output is the minimum cost k∗ -GED between G1 and G2 . It calls the Algorithm 1 to perform k∗ -degree node contraction on G1 and G2 in lines 1–2. The transformed graphs are G1 and G2 with vertex set V1 = {u1 , . . . , un } and V2 = {v1 , . . . , vm } respectively. The algorithm initializes an empty set S in line 3. In the for loop in lines 4–6, S is updated by substitution of vertex u1 of G1 with each vertex of G2 , then deletion of u1 in line 7 is added to S. The while loop in lines 8–28, is used to compute the minimum cost edit path Cmin , from S. Computation of minimum cost edit path is usually performed using tree-based search algorithm like Astar search where the top node or root denotes the first edit operation and bottom or leaf node represents the last edit operation. Edit path from the root to leaf nodes constitutes a complete edit distance path, and it exhibits an edit path to transform a graph to another one which may or may not be optimal. If we want to return optimal edit path, then during each level of search we have to consider all the combinations of edit operations in the set S, which can be computationally much expensive. An alternative is to prune the set S (line 9) using various heuristic techniques to consider only the partial set of edit operations which leads to a suboptimal but relatively efficient solution. For example, we can use beam search to limit the search space by considering only w best possibility at each level of search, where w is called as beam width. During the execution of the algorithm, if Cmin is the complete edit distance path then the algorithm returns its value in line 12; otherwise all the unprocessed nodes of G2 are added in Cmin and S is updated in lines 14–18. Finally, every unprocessed node of G1 are substituted by each node of G2 and these operations are added to Cmin , together with the deletion of
61
k n−1 k n− p (1 − p)n−k−1 ≤ n ≤ n − (n − 1 ) p(1 − p)n−2 . k n=1
Here, n is the number of nodes in G1 and n is the number of nodes in G1 obtained after k∗ -NC(G1 ). So, the number of contracted nodes are n − n . We have, number of nodes removed during k∗ -NC(G1 ) ≤ n − ∗ n ≤ number of nodes removed during ), which implies (n − kk -ND(Gn1−k p ( 1 − p) −1 , where left most 1 ) p(1 − p)n−2 ≤ n − n ≤ kn=1 n−1 k term is the number of nodes removed during 1∗ -NC or 1∗ -ND, since both are equivalent operations. Now multiplying expression kthe above n−k−1 ≤ n − by -1 and rearranging the terms − kn=1 n−1 p ( 1 − p ) k n−2 n ≤ −(n − 1 ) p(1 − adding n in above expression we get p) , byn−k k n−1 k n − n=1 k p (1 − p) −1 ≤ n ≤ n − (n − 1 ) p(1 − p)n−2 .
4. Experimental validation In this section, we compare the proposed GM framework with other important GM methods. To evaluate the execution time and accuracy of k∗ -Graph-Edit-Distance, we use the IAM graph database [40] and graph matching toolkit [41]. We use the letter database and AIDS database of IAM graph repository for the results. 4.1. Dataset description Letter graphs consist of capital letters of alphabets, drawn using straight lines only. It includes 15 classes of capital letters namely A, E, F, H, J, K, L, M, N, T, V, W, X, Y, and Z. For each prototype graph, distortions of three distinct levels, i.e., high, medium and low are applied to generate various graph dataset. The graphs of letter dataset are uniformly distributed across the 15 letters. All nodes
62
S.P. Dwivedi, R.S. Singh / Pattern Recognition Letters 116 (2018) 58–64
Fig. 2. Fraction of graphs with their size for AIDS dataset.
Fig. 3. GED vs. k∗ -GED computation on letter graphs.
are labeled with an (x, y) coordinate representing its position in a reference plane. The average number of nodes and edges per graph in letter graph data of high distortion level is 4.7 nodes and 4.5 edges respectively. The maximum number of nodes and edges per graph for this graph dataset are both 9. AIDS dataset contains graph characterizing chemical compounds. It consists of two different class of molecular compounds, i.e., confirmed active and confirmed inactive. Active class molecules show activity against HIV, whereas inactive class represents inactivity against HIV. Labels on node denote chemical symbol whereas labels on edges exhibit valence. In AIDS dataset average number of nodes per graph is 15.7 nodes while the average number of edges per graph is 16.2 edges. The maximum number of nodes and edges per graph is 95 nodes and 103 edges respectively. In Fig. 2 we can observe the fraction of graphs concerning their size for active and inactive molecules of the training set of AIDS dataset. We note that the number of nodes in active molecules is usually more than that of inactive molecules. 4.2. Execution time comparison All results in this section are computed using the system having 9.8 GB of memory and running the processor at 3.40 GHz. Comparison of average execution time of GM in milliseconds for GED and k∗ -GED (where k=1,2 and 3) for letter graphs, using Astar and with beam search optimization having beam width w = 10 is shown in Fig. 3. There is a sharp change in running time from GED to 1∗ -GED using Astar. This decrease in execution time accounts for reduction in 1-degree nodes in the input graphs. Comparison of running time for GED and k∗ -GED for AIDS graphs using Astar is given in Fig. 4, whereas Fig. 5 shows the time in ms with beam search heuristic. Here also, there is a sudden decrease in execution time from GED to 1∗ -GED using Astar, which becomes lesser from 1∗ -GED to 2∗ -GED and further from 2∗ -GED
Fig. 4. GED vs. k∗ GED computation on AIDS graphs.
Fig. 5. GED vs. k∗ GED computation on AIDS graphs using beam search. Table 1 Accuracy on letter dataset using GED and k∗ -GED. Class
GED
1∗ -GED
2∗ -GED
3∗ -GED
A E F H I K L M N T V W X Y Z
94 80 80 70 94 86 86 96 86 90 90 94 78 92 90
70 54 64 42 06 44 56 90 64 50 48 78 52 76 80
64 54 44 30 06 38 36 60 52 46 46 56 50 52 64
64 54 42 30 06 38 36 60 52 44 46 54 50 52 64
to 3∗ -GED. This is primarily due to reason that, we can not remove easily the 2-degree and 3-degree nodes from the graph as compared to 1-degree nodes without making the graph disconnected. 4.3. Accuracy comparison For accuracy evaluation, we consider the problem of classification of letter graphs using nearest neighbor classifier. We use 750 letter graphs of high distortion of the test dataset, which consists of 50 graphs for each of the 15 classes of letter dataset. We also use 750 graphs of training dataset, which again includes 50 graphs for each of the 15 letters. Comparison of classification accuracy for each of the 15 letters using Astar based GED and k∗ -GED for k = 1 to 3 is shown in Table 1, whereas classification accuracy of GED and k∗ -GED based on beam search is shown in Table 2. Here, we
S.P. Dwivedi, R.S. Singh / Pattern Recognition Letters 116 (2018) 58–64
63
Table 2 Accuracy on letter dataset using GED and k∗ -GED with beam. Class
GED
1∗ -GED
2∗ -GED
3∗ -GED
A E F H I K L M N T V W X Y Z
90 86 84 60 94 80 86 94 84 88 88 92 76 92 90
70 54 64 42 06 44 56 90 64 50 48 78 52 76 80
64 54 44 30 06 38 36 60 52 46 46 56 50 52 64
64 54 42 30 06 38 36 60 52 44 46 54 50 52 64
Fig. 6. Effect of k∗ -NC and k∗ -ND on the topology of Letter A.
Table 3 Accuracy on AIDS dataset using GED and k∗ GED with beam. Class
Active
Inactive
GED with beam 1∗ -GED with beam 2∗ -GED with beam 3∗ -GED with beam 4∗ -GED with beam
98.6 98.6 97.3 96.6 96.6
99.9 99.3 99.2 99.1 99.1
Table 4 Accuracy on AIDS dataset using Bipartite GED and k∗ -GED. Class Bipartite Bipartite Bipartite Bipartite Bipartite
GED 1∗ -GED 2∗ -GED 3∗ -GED 4∗ -GED
Active
Inactive
98.6 98.6 97.3 97.0 96.6
99.9 99.3 99.2 99.2 99.1
can observe that letters having less number of straight lines have less accuracy while letter having more straight lines have usually higher accuracy using k∗ -GED. For example letters I,L,T, and V have less accuracy whereas letters M,W,Y, and Z have higher accuracy. We also note that the accuracy of k∗ -GED remains almost same with or without beam search, as the number of nodes in the letter graphs obtained after k∗ -GED becomes so small such that the edit path considered by beam search becomes identical to that of Astar. To evaluate accuracy on AIDS dataset, We use 1500 graphs of test dataset including 300 graphs from the active class and 1200 graphs from the inactive class of AIDS molecules. We also use 250 graphs of training dataset consisting of 50 graphs of active class and 200 graphs of inactive class. Comparison of classification accuracy of AIDS dataset for GED using beam search heuristic with k∗ GED for k = 1 to 4 using beam search heuristic having beam width w = 10 is shown in Table 3. Also, the comparison of classification accuracy of AIDS dataset using bipartite GED with bipartite k∗ -GED for k = 1 to 4 is shown in Table 4. We can observe that classification accuracy for AIDS dataset is more than that of letter dataset. This increased accuracy shows that this GM model is more relevant for large graphs, as the contraction of nodes in small graphs tends to modify the graph more as compared to graphs with a large number of nodes.
Fig. 7. Effect of k∗ -NC and k∗ -ND on the topology of active molecules of AIDS dataset.
4.4. Topological considerations and discussion Node contraction operation changes the topology of the input graphs. We can observe the effect of k∗ -NC on the graph topology of the training set of letter A in Fig. 6. For comparison purpose, we have included the effect of k∗ -ND on the structure of the same graphs. We can also examine the effect of k∗ -NC and k∗ -ND on the topology of graphs of the training set of active molecules of AIDS dataset in the Fig. 7. Here, we can notice the abrupt change in the average number of nodes in k∗ -ND from k = 1 to 3, as it deletes almost the entire structure of graphs. Therefore k∗ -NC can be used as a compromise between change in topology and efficiency because it changes the structure of the graphs up to a certain extent only. The proposed method can be useful in applications, where graph representation is relatively dense and have a large number of nodes. Depending on the requirement of time and exactness of similarity, we can proceed from k = 0 to k = n. If exact matching is must regardless of time spent, we have to use k = 0, which is nothing but standard GED. If the exact similarity is more important, then we can proceed from k = 1, otherwise if time is more crucial, then we can proceed from k = n. Where n is the minimum of the second highest degree of nodes between G1 and G2 . It can also be used as an online or anytime graph matching scheme, where we need to find a matching under some time constraint. As mentioned above, k∗ -ND-GED which allows the deletion of nodes and its associated edges, even if it is a cut vertex can provide a further efficiency but may be at the cost of much less accuracy. 5. Conclusion In this paper, we presented an approach to error-tolerant GM using node contraction. It works by removing the nodes based on
64
S.P. Dwivedi, R.S. Singh / Pattern Recognition Letters 116 (2018) 58–64
their degree centrality as a measure of importance. We deleted the least degree nodes provided this does not increase the connected components. k∗ -Node-Contraction can be used as a preprocessing step on the top of any GM algorithms. We implemented the proposed method on the letter and AIDS dataset, and the result shows efficiency in execution time at the cost of a decrease in accuracy. Results on AIDS dataset are more promising, which shows that the approach is more suitable for large graphs. We have also described the effect of node contraction on the topology of graphs. In general, the algorithm achieves efficiency without disturbing the topology of graphs too much. References [1] C.C. Aggarwal, H. Wang, Managing and mining graph data, Advances in Database Systems, Springer, 2010. [2] M. Neuhaus, H. Bunke, Bridging the Gap Between Graph Edit distance and Kernel Machines, World Scientific, 2007. [3] D. Conte, P. Foggia, C. Sansone, M. Vento, Thirty years of graph matching in pattern recognition, Int. J. Pattern Recognit. Artif. Intell. 18 (2004) 265–298. [4] K. Riesen, Structural Pattern Recognition with Graph Edit Distance, Approximation Algorithms and Applications, Springer, 2015. [5] P. Foggia, G. Percannella, M. Vento, Graph matching and learning in pattern recognition in the last 10 years, Int. J. Pattern Recognit. Artif. Intell. 28 (2014) 1450 0 01.1–1450 0 01.40. [6] H. Bunke, Error-tolerant graph matching: a formal framework and algorithms, Proceedings of the International Workshop on Structural, Syntactic and Statistical Pattern Recognition (SSPR and SPR) 1451 (1998). [7] P.E. Hart, N.J. Nilson, B. Raphael, A formal basis for heuristic determination of minimum cost paths, IEEE Trans. Syst. Sci. Cybern. 4 (1968) 100–107. [8] W.H. Tsai, K.S. Fu, Error-correcting isomorphisms of attributed relational graphs for pattern analysis, IEEE Trans. Syst. Man Cybern. 9 (1979) 757–768. [9] A. Sanfeliu, K.S. Fu, A distance measure between attributed relational graphs for pattern recognition, IEEE Trans. Syst. Man Cybern. 13 (1983) 353–363. [10] M.A. Fischler, R.A. Elschlager, The representation and matching of pictorial structures, IEEE Trans. Comput. 22 (1973) 67–92. [11] W. Christmas, J. Kittler, M. Petrou, Structural matching in computer vision using probabilistic relaxation, IEEE Trans. Pattern Anal. Mach. Intell. 17 (1995) 749–764. [12] E.R. Hancock, J. Kittler, Discrete relaxation, Pattern Recognit. 23 (1990) 711–733. [13] R. Wilson, E. Hancock, Structural matching by discrete relaxation, IEEE Trans. Pattern Anal. Mach. Intell. 19 (1997) 634–648. [14] B. Huet, E.R. Hancock, Shape recognition from large image libraries by inexact graph matching, Pattern Recognit. Lett. 20 (1999) 1259–1269. [15] J. Kittler, E.R. Hancock, Combining evidence in probabilistic relaxation, Int. J. Pattern Recognit. Artif. Intell. 3 (1989) 29–51. [16] R. Myers, R.C. Wilson, E.R. Hancock, Bayesian graph edit distance, IEEE Trans. Pattern Anal. Mach. Intell. 22 (20 0 0) 628–635. [17] T. Caelli, S. Kosinov, Inexact graph matching using eigen-subspace projection clustering, Int. J. Pattern Recognit. Artif. Intell. 18 (2004) 329–355. [18] A. Robles-Kelly, E.R. Hancock, Graph edit distance from spectral seriation, IEEE Trans. Pattern Anal. Mach. Intell. 27 (2005) 365–378.
[19] A. Shokoufandeh, D. Macrini, S. Dickinson, K. Siddiqi, S. Zucker, Indexing hierarchical structures using graph spectra, IEEE Trans. Pattern Anal. Mach. Intell. 27 (2005) 1125–1140. [20] P. Frasconi, M. Gori, A. Sperduti, A general framework for adaptive processing of data structures, IEEE Trans. Neural Netw. 9 (1998) 768–786. [21] A. Sperduti, A. Starita, Supervised neural networks for the classification of structures, IEEE Trans. Neural Netw. 8 (1997) 714–735. [22] P. Suganthan, E. Teoh, M. D., Pattern recognition by homomorphic graph matching using hopfield neural network, Image Vis. Comput. 13 (1995) 45–60. [23] A. Barsi, Neural self organization using graphs, machine learning and data mining in pattern recognition 2734 (2003). [24] A. Cross, R. Wilson, E. Hancock, Inexact graph matching using genetic search, Pattern Recognit. 30 (1997) 953–970. [25] T. Gartner, Kernels for Structured Data, World Scientific, 2008. [26] D. Haussler, Convolution kernels on discrete structures, University of California, Sant Cruz, 1999. [27] J. Lafferty, G. Lebanon, Diffusion kernels on statistical manifolds, J. Mach. Learn. Res. 6 (2005) 129–163. [28] H. Bunke, G. Allerman, Inexact graph matching for structural pattern recognition, Pattern Recognit. Lett. 1 (1983) 245–253. [29] M. Neuhaus, K. Riesen, H. Bunke, Fast suboptimal algorithms for the computation of graph edit distance, Proceedings of the International Workshop on Structural, Syntactic and Statistical Pattern Recognition (SSPR and SPR) 4109 (2006) 163–172. [30] S. Sorlin, C. Solnon, Reactive tabu search for measuring graph similarity, Proceedings of the International Workshop on Graph Based Representations in Pattern Recognition 3434 (2005) 172–182. [31] K. Riesen, H. Bunke, Approximate graph edit distance computation by means of bipartite graph matching, Image Vis. Comput. 27 (2009) 950–959. [32] M. Ferrer, F. Serratosa, K. Riesen, Improving bipartite graph matching by assessing the assignment confidence, Pattern Recognit. Lett. 65 (2015) 29–36. [33] K. Riesen, H. Bunke, Improving bipartite graph edit distance approximation using various search strategies, Pattern Recognit. 48 (2015) 1349–1363. [34] K. Riesen, A. Fischer, H. Bunke, Estimating graph edit distance using lower and upper bounds of bipartite approximations, Int. J. Pattern Recognit. Artif. Intell. 29 (2015) 1550011. [35] M. Stauffer, T. Tschachtli, A. Fischer, K. Riesen, A survey on applications of bipartite graph edit distance, Proceedings of the International Workshop on Graph Based Representations in Pattern Recognition 10310 (2017) 242–252. [36] H. Zhang, P. Ren, Game theoretic hypergraph matching for multi-source image correspondences, Pattern Recognit. Lett. 87 (2017) 87–95. [37] M.A. Pinheiro, J. Kybic, P. Fua, Geometric graph matching using monte carlo tree search, IEEE Trans. Pattern Anal. Mach. Intell. 39(11) (2017) 2171–2185. [38] S.P. Dwivedi, R.S. Singh, Error-tolerant graph matching using homeomorphism, Proceedings of the International Conference on Advances in Computing, Communication and Informatics (ICACCI) (2017) 1762–1766. [39] R. Ambauen, S. Fischer, H. Bunke, Graph edit distance with node splitting and merging, and its application to diatom identification, Proceedings of the IAPR Workshop on Graph-based Representation in Pattern Recognition 2726 (2003). [40] K. Riesen, H. Bunke, IAM Graph database repository for graph based pattern recognition and machine learning, Proceedings of the International Workshop on Structural, Syntactic and Statistical Pattern Recognition (SSPR and SPR) 5342 (2008) 287–297. [41] K. Riesen, S. Emmenegger, H. Bunke, A novel software toolkit for graph edit distance computation, Proceedings of the International Workshop on Graph Based Representations in Pattern Recognition 7877 (2013) 142–151.