Levenshtein Distance for Graph Spectral Features - Semantic Scholar

2 downloads 0 Views 744KB Size Report
resentations are therefore of diflerent sizes. We use the concept of the stting-edit distance to allow for the missing eigenmodes and compare the correct modes to.
Levenshtein

Distance

for Graph

Spectral

Features

Richard C. Wilson and Edwin R. Hancock Department of Computer Science University of York Heslington, York, UK [email protected] Abstract Graph

structures

play

a critical

role

in computer

but they are inconvenient nition tasks because of their

combinatotial

the

constructing

sion,

consequent

difjiculty

in

to use in pattern

virecog-

nature and feature vec-

Spectral representations have been used for this tusk which are bused on the eigensystem of the gruph Lupluciun matrix. However, graphs of diflerent sizes tors.

produce

eigensystems

of diflerent

sizes

where

not

all

are present in both graphs. paper we use the Levenshtein distance to compure spectral representations under gruph edit operutions which add or delete vertices. The spectral repWe use resentations are therefore of diflerent sizes. the concept of the stting-edit distance to allow for the missing eigenmodes and compare the correct modes to each other. We evaluate the method by first using generated gruphs to compare the eflect of vertex deletion operations. We then examine the performance of the method on graphs from a shape database. eigenmodes In this

1

Introduction

Graphs play a critical role in computer vision because they can represent structural descriptions and relationships between features. The key problem in utilising graph structures lies in measuring their similarity to each other. In general the nodes of a graph are not ordered or labelledj and the correspondence problem between nodes must be solved before the structural similarity can be assessed. In other words a mapping must be found between the nodes, which is equivalent to finding a permutation of the nodes which brings them into the same order. For noisy graphs (those which are not exactly the same) this problem is NP-hard. There are a number of ways in which this problem may be tackledj for example by performing

editing operations[2, Iij and counting the number of consistent relationships[l2]. More recently, graph spectral theory has been employed to find features which are invariant to relabelling of the nodes and therefore directly represent the structure of the graph. The advantage of this method is that there is no need for a costly matching step to bring the nodes of two graphs into correspondence. Graph spectral theory is a branch of mathematics which can be used to characterise the properties of a graph using eigenvectors of the connection matrix[3]. In fact a number of investigators have exploited the eigenvalues of this matrix in clustering algorithms[I3, IOj 41. Scott and Longuet-Higgins[II] have used the eigenvector orthonormal property to perform Procrustes alignment on point sets by finding the point mappings. Umeyama[IS] has developed a method for finding the permutation matrix which best maps a weighted graph onto another graph, based on the spectral decomposition of the graphs. The use of graph-spectral methods for correspondence matching has proved to be an altogether more elusive task. The idea underpinning spectral methods for correspondence analysis is to locate matches between nodes by comparing the eigenvalues and eigenvectors of the adjacency matrix. However, although this method works well for graphs with the same number of nodes, and small differences in edge structurej it does not work well when graphs of different size are being matched. The reason for this is that the eigenvectors of the adjacency matrix are unstable under changes in the size of the adjacency matrix. To overcome this problem, Luo and Hancock [81j have drawn on the apparatus of the EM algorithm, and treat the correspondences as missing or hidden data. By introducing a correspondence probability matrix, they overcome problems associated with the different sizes of the adjacency matrices. An alternative solution to the problem of size difference is adopted by Kosinov and Caelli [5], who project the graph onto the

0-7695-2128-2/04 $20.00 (C) 2004 IEEE

eigenspace spanned by its leading eigenvectors. Provided that the eigenvectors are normalised, then the relative angles of the nodes are robust to size difference under the projection. Recent work by Robles-Kelly and Hancock [9] has shown how an eigenvector method can be used to sort the nodes of a graph into string order and have used string matching methods to overcome the size difference problem.

2

Representation

Consider the undirected graph S = (V,EjW) with node-set V = {vl j v2 j . . . j vn} j edge-set E = {elj ezj. . . j e,} c V x V and weight function W : E :-+ [Oj I]. The weighted adjacency matrix is defined to be if (‘u,,‘ub) E E otherwise The Laplacian of the graph is given by L = D - A. where D,, = CrZ1 Aab is the diagonal node degree matrix whose elements are the number of edges which exit the node. The Laplacian is more suitable for spectral analysis than the adjacency matrix since it is positive semi-definite. This representation can be extended to edge attributes by using a Hermitian matrix with complex elements. Each off-diagonal element is a complex number which has two components, and can therefore represent a 2-dimensional measurement vector. The on-diagonal elements are necessarily real quantitiesj so the node measurements are limited to a single quantity. The off-diagonal elements of H are chosen to be

where y/a~ is a binary edge measurement. In other wordsj the connection weights are encoded by the magnitude of the complex number Hab and the binary measurement by its phase. The spectrum of L (or H) is found by performing the eigenvector expansion L = + -

Xieief ““6

i-1

where Xi and ei are the n eigenvectors and eigenvalues of the matrix L. The information in the eigenvalues and eigenvectors can be used to compare graph structures.

3

Spectral

Features

A number of spectral features have been proposed in the literature. These features are based on the spectral

matrix and must be invariant to changes in the vertexlabelling. The eigenvalues have been used by Siddiqi et a1[14] to characterise shape-trees. Luo et a1[7] have used a number of modal cluster based measures to compare graphs. These include cluster volume, perimeter and the Cheeger constant. Wilson and Hancock[l7] have used spectral polynomials as features, which we use in this paper. All these features are ordered by the magnitude of the eigenvalues of the graph. The key problem with using such spectral features is ensuring that the same spectral modes are being compared. The modes are ordered according to the magnitude of the corresponding eigenvalues. Changes in the graph structure can lead to changes in the order of eigenvalues. This is particularly problematic when the graphs are of different sizes. If the size change is due to node dropout, then some modes are completely missing. While the remaining modes may still be in the correct orderj they cannot be directly compared with those of the larger graph because it is not known which are missing.

3.1 Levenshtein Distance The Levenshtein or string edit-distance[6j 161 is a distance measure which operates on strings of different lengths. Such a distance can be adapted to operate on lists of spectral modes, particularly in the case where the size of the graphs, and therefore the number of modes, is different. The Levenshtein distance operates by considering both insertion and deletion on the strings as well as direct comparisons. In the context of our spectral mode listj the insertion and deletion operations correspond to a missing eigenmode in one or other of the graphs. The comparison operation occurs when the modes are assumed to represent the same featurej and therefore the distance between them can be measured directly. The distance between two spectral modes is measured by the Mahalanobbis distance between the feature vectors which represent them, with a covariance matrix which is constrained to be diagonal. In the experiments presented later, we have used the polynomial features which are detailed in [17]. The process is demonstrated in figure 3.1. A path from the top-left of the diagram to the bottom-right represents an edit-path which compares graph 1 to graph 2. Diagonal sections are the comparison of two spectral modes from each graph. A horizontal section corresponds to a missing spectral mode in graph &. Similarly, a vertical section would correspond to a missing mode in &. The minimum-distance path across the grid is the Levenshtein distance between the two feature sets. The cost of a missing mode is a value which

0-7695-2128-2/04 $20.00 (C) 2004 IEEE

ml 4fd4 m2

52

m3

m

ni

n2

CP)=d(m, nd + dOwE) + d(m3,nd + dOa, n3)

n3

Figure 1. An example

edit matrix

must be set empirically.

4

Pattern Distance

Spaces with

the Levenshtein

In order to embed the graphs in a vector space so that they can be visualised, we need to associate a point in space with each of the graphs. By using the Levenshtein distance to compare the similarities of graphs, we are no longer employing a vector-based representation of graphs. Methods such as principal components or linear discriminants are no longer suitable for this data. We do however have an efficient way to compute the distances between graphs. We therefore turn the classical multidimensional scaling method to embed the graphs in a Euclidean space using the matrix of pairwise dissimilarities. Let D be the matrix of distances between the elements of the graph data-set. In other wordsj dij is the Levenshtein distance between the spectral representations of graphs i and j. The result of the MDS analysis of the distance matrix is a set of points {xl . . .xR}~ with a single point representing each graph in the data-set. The Euclidean distances between the embedded points approximates the graph distances computed using the Levenshtein distance.

5

Experimental

results

In the first experiment we compare the direct vectorial distance measure to the Levenshtein distance. We first construct a graph of 30 vertices and 100 edges, chosen at random. We then delete a vertex from this graph to obtain a new edited graph. This operation is very disruptive to the eigensystem of the graph since on average it changes the configuration of more than 40% of the nodes in the graph. We then construct another random graph with 29 edges and 93 edges. The idea is to evaluate the ability of the distance measure to distinguish between edited and unrelated graphs. The direct vectorial distance between the graphs is computed by ordering the spectral modes by eigenvalue and comparing them in order. Size differences are accommodated by padding the representation with zero

04 0.35 1 034

04 18

Figure 2. Distributions of edited graphs random graphs for the vector distance Levenshtein distance.

and and

eigenmodes. The Levenshtein distance is computed as described above. Figure 5 shows the distributions generated by the edited and random graph distances. The left-hand plot is for the vectorial distance, and the confusion probability is 42%. On the right, the Levenshtein distance has improved the separability of the distributions and the confusion probability is now 17%. In the second experimentj we apply the Levenshtein distance to graphs based on shape skeletons. Our experiments are performed using a database of 42 binary shapes. Each binary shape is extracted from a 2D view of a 3D object. There are 3 classes in the database, and for each object there are a number of views acquired from different viewing directions and a number of different examples of the class . We extract the shape skeleton from each binary shape and attribute the resulting tree. Similar shapes have different graphs due to missing branches in the segmentation process. We then compute the distance between these trees and construct a space for visualisation using the MDS technique described earlier. The results are shown in figure 5. The space derived from the Levenshtein distance has a more compact grouping of similar shapes, partic-

0-7695-2128-2/04 $20.00 (C) 2004 IEEE

V. Levenshtein. Binary codes capable of correcting deletions insertions and reversals. Soviet PhysicsDokludyj 10:707~710, 1966. B. Luo, R. C. Wilson and E. R. Hancock. Spectral embedding of graphs. Pattern Recognition, 36(10):22&2230, 2003. Bin Luo and E. R. Hancock. Structural graph matching using the em algorithm and singular value decomposition. IEEE Transactions on Puttern Analysis and Machine Intelligence, 23:11201136, 2001. A. Robles-Kelly and E.R. Hancock. Edit distance from graph spectra. In Proc. 9th IEEE Internutionul Conference on Computer Visionj volume Ij pages 127-135, 2003. S. Sarkar and K. L. Boyer. Preceptual organization in computer vision. IEEE Trans. Systems, il&un and Cybernetiq 23:382%399, 1993. G. Scott and H. Longuet-Higgins. An algorithm for associating the features of two images. Proceedings of the Royal Society BioEogicuE, 244:2&26, 1991.

Figure 3. MDS plots of pattern spaces from the distance matrix. Top: vector distance. Bottom: Levenshtein distance

of London

Seties B-

L. G. Shapiro and R. M. Haralick. Structural descriptions and inexact matching. IEEE Trunsations on Pattern Analysis and Muchine Intelligencej

3(5):504&519,

1981.

J. Shi and J. Malik. Normalized cuts and image segmentation. CVPR, pages 731-737, 1997.

ularly for the hand.

References A.Torsello and E.R.Hancock. Efficiently computing weighted tree edit distance using relaxation labeling. Lecture Notes in Computer Sciencej 2134:4388453, 2001.

K. Siddiqi A. Shokoufandeh, S. J. Dickenson, and S. W. Zucker. Indexing using a spectral encoding of topological structure. Proceedings of the Computer Vision and Pattern Recognition Conferencej 1998.

H. Bunke. On a relation between graph edit distance and maximum common subgraph. Pattern

S. Umeyama. An eigendecompostion approach to weighted graph matching problems. IEEE Trunsactions on Pattern Analysis and Machine Intelli-

Recognition

gencej

Letters,

F. R. K. Chung. 1997.

18:689%694, 1997. SpectruE Gruph

Theory.

AMS,

K. Inoue and K. Urahama. Sequential fuzzy cluster extraction by a graph spectral method. Pattern Recognition

Letters,

20(7):699%705,

1999.

S. Kosinov and T. Caelli. Inexact multisubgraph matching using graph eigenspace and clustering models. Structural, Syntutic and Statistical Puttern Recognition,

LNCSj

2396:133%142,

10(5):695-703,

1988.

R. A. Wagner and M. J. Fischer. The string-tostring correction problem. JournuE of the ACMj 21:1688173, 1974. R. C. Wilson and E. R. Hancock. Pattern spaces from graph polynomials. In 12th InternutionuE Conference on Image Analysis and Processing, pages 4806485 j 2003.

2002.

0-7695-2128-2/04 $20.00 (C) 2004 IEEE