On median graphs - Semantic Scholar

Report 1 Downloads 147 Views
1144

IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE,

On Median Graphs: Properties, Algorithms, and Applications Xiaoyi Jiang, Andreas MuÈnger, and Horst Bunke AbstractÐIn object prototype learning and similar tasks, median computation is an important technique for capturing the essential information of a given set of patterns. In this paper, we extend the median concept to the domain of graphs. In terms of graph distance, we introduce the novel concepts of set median and generalized median of a set of graphs. We study properties of both types of median graphs. For the more complex task of computing generalized median graphs, a genetic search algorithm is developed. Experiments conducted on randomly generated graphs demonstrate the advantage of generalized median graphs compared to set median graphs and the ability of our genetic algorithm to find approximate generalized median graphs in reasonable time. Application examples with both synthetic and nonsynthetic data are shown to illustrate the practical usefulness of the concept of median graphs. Index TermsÐMedian graph, graph distance, graph matching, genetic algorithm, learning.

æ 1

INTRODUCTION

GRAPHS are a general and powerful data structure for the

representation of objects and concepts. In a graph representation, the nodes typically represent objects or parts of objects, while the edges describe relations between objects or object parts. Graphs have some interesting invariance properties. For instance, if a graph, which is drawn on paper, is translated, rotated, or transformed into its mirror image, it is still the same graph in the mathematical sense. These invariance properties, as well as the fact that graphs are well-suited to model objects in terms of parts and their relations, make them very attractive for various applications in pattern recognition and computer vision. Examples include character recognition [19], [24], schematic diagram interpretation [17], shape analysis [22], and 3D object recognition [33]. The discipline of machine learning is concerned with algorithms by which a system can automatically construct models, knowledge, or skills from the outside world. Generally, there are different categories of approaches to machine learning, for example, learning in neural networks, symbolic learning from examples, case-based learning, explanation-based learning, or reinforcement learning. For a general introduction to the area of machine learning and an overview, the reader is referred to [10]. Overviews of the state-of-the-art of machine learning in computer vision can be found in [1], [20], [26]. In object prototype learning, we are given a set of noisy samples of the same object and want to infer a representative model. In this context, the median concept turns out to be very useful. If graphs are used for representing the objects under consideration, then we are faced with the task of finding the median of a set of graphs. Given a set of graphs, the median is defined as the graph that has the smallest sum of distances to all graphs in the set. Here, we can distinguish between set median and generalized median graphs. The difference lies in the space of graphs where the respective median is searched for (formal definitions will be given in Section 2). Note that in graph theory the term median graph is also used to define a . The authors are with the Department of Computer Science, University of Bern, CH-3012 Bern, Switzerland. E-mail: {jiang, muenger, bunke}@iam.unibe.ch. Manuscript received 3 Feb. 2000; revised 26 Jan. 2001; accepted 9 July 2001. Recommended for acceptance by S. Dickinson, M. Pelillo, R. Zabih. For information on obtaining reprints of this article, please send e-mail to: [email protected], and reference IEEECS Log Number 111388. 0162-8828/01/$10.00 ß 2001 IEEE

VOL. 23,

NO. 10,

OCTOBER 2001

special class of graphs. According to [15], a median graph is a connected graph such that, for every triple of nodes u, v, w, there is a unique x lying on a geodesic (i.e., shortest path) between each pair of u, v, w. By contrast, in our work, a median graph is the representative of a given set of graphs. The computation of both set and generalized median graph is exponential in nature. While the computation time for set median graphs is exponential in the size of the input graphs, but polynomially bounded by the number of those graphs, the complexity of computing generalized median graphs is exponential in both the number of input graphs and their size. As a consequence, in order to make the practical use of the mediangraph concept possible, we have to resort to approximate solutions. There exist numerous instances of approximate algorithms for highly complex discrete optimization problems in pattern recognition and computer vision. Examples include simulated annealing [14], mean-field annealing [34], tabu search [8], and genetic search [21]. In this work, we adopt a genetic search strategy. In this paper, we introduce the novel concepts of set and generalized median graph, derive some properties of median graphs, and develop algorithms for their computation. We start with the basic terminology and the definition of median graphs in the next section. Their properties are then discussed in Section 3. A genetic search algorithm for computing generalized median graphs is given in Section 4. Section 5 describes an experimental evaluation of the algorithm and discusses potential applications of the median-graph concept. Finally, some discussions conclude the paper. A preliminary version of this paper appeared in [11].

2

DEFINITIONS AND NOTATION

In this work, the concept of median is extended to the domain of graphs. This section introduces our basic terminology. We will be concerned with labeled directed graphs. Let LV and LE denote the set of node and edge labels, respectively. Definition 1. A labeled and directed graph G is a 4-tuple G ˆ …V ; E; ; †, where . . . .

V is the set of nodes, E  V  V is the set of edges,  : V ! LV is a function assigning labels to the nodes, and  : E ! LE is a function assigning labels to the edges.

Note that undirected graphs are a special case of directed graphs where we require …x1 ; x2 † 2 E iff …x2 ; x1 † 2 E. Fundamental to the concept of median graphs is a distance function d…g1 ; g2 † that measures the dissimilarity of two graphs g1 and g2 . Definition 2. Let U be the set of all graphs that can be constructed using labels from LV and LE . Given S ˆ fg1 ; g2 ; . . . ; gn g  U, the generalized median graph g and the set median graph g^ of S are defined by g ˆ arg min g2U

n X

d…g; gi †

iˆ1

and g^ ˆ arg min g2S

n X

d…g; gi †;

iˆ1

respectively. Both the generalized median and the set median graph minimize the sum of distances (SOD) to all input graphs and the only difference lies in the graph space where the median is

IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE,

searched for. The generalized median is the more general concept and, therefore, usually a better representation of the given patterns than the set median. Notice that g is usually not a member of S. In general, several generalized median graphs and several set median graphs may exist. However, this is usually not a drawback in practice since any such graph may serve equally well as a representative of the given set. In this work, we use a distance function based on errorcorrecting graph matching in terms of graph-edit operations. Informally speaking, the distance between two graphs is the minimum cost, taken over all sequences of edit operations that transform one of the two graphs into the other. Definition 3. Let g1 ˆ …V1 ; E1 ; 1 ; 1 † and g2 ˆ …V2 ; E2 ; 2 ; 2 † be two graphs. An error-correcting graph matching (ECGM) from g1 to g2 is a bijective function f : V^1 ! V^2 , where V^1  V1 and V^2  V2 . We say that node x 2 V^1 is substituted by node y 2 V^2 if f…x† ˆ y. If 1 …x† ˆ 2 …f…x††, then the substitution is called an identical substitution. Otherwise, it is termed a nonidentical substitution. Any node from V1 ÿ V^1 is deleted from g1 and any node from V2 ÿ V^2 is inserted in g2 under f. The mapping f directly implies an edit operation on each node in g1 and g2 . For example, nodes are substituted, deleted, or inserted, as described above. Additionally, the mapping f indirectly implies edit operations on the edges of g1 and g2 . If f…x1 † ˆ y1 and f…x2 † ˆ y2 , then the following situations are possible: . . . .

…x1 ; x2 † 2 E1 and …y1 ; y2 † 62 E2 : In this case, …x1 ; x2 † is deleted from g1 . …x1 ; x2 † 62 E1 and …y1 ; y2 † 2 E2 : Here, …y1 ; y2 † is inserted in g2 . …x1 ; x2 † 2 E1 and …y1 ; y2 † 2 E2 : In this situation, …x1 ; x2 † in g1 is substituted by …y1 ; y2 † in g2 . If 1 …x1 ; x2 † ˆ 2 …y1 ; y2 †, the substitution is an identical substitution. …x1 ; x2 † 62 E1 and …y1 ; y2 † 62 E2 : No edit operation is implied.

Edit operations for edges …x2 ; x1 † and …y2 ; y1 † in the opposite direction are defined in a similar way. If a node x is deleted from g1 , then any edge incident to x is deleted, too. Similarly, if a node x0 is inserted in g2 , then any edge incident to x0 is inserted, too. Obviously, any ECGM f can be understood as a set of edit operations (substitutions, deletions, and insertions of both nodes and edges) that transform a given graph g1 into another graph g2 . An ECGM f : V^1 ! V^2 from a graph g1 ˆ …V1 ; E1 ; 1 ; 1 † to a graph g2 ˆ …V2 ; E2 ; 2 ; 2 † always implies the following sets of nodes and edges: . . . . . .

Vns ˆ V^1  V1 , the nodes x of g1 which are substituted by the corresponding node f…x† of g2 ; Vnd ˆ V1 ÿ V^1  V1 , the nodes which are deleted from g1 ; Vni ˆ V2 ÿ V^2  V2 , the nodes which are inserted in g2 ; Ees  E1 , the edges …x1 ; x2 † in g1 which are substituted by the corresponding edge …f…x1 †; f…x2 †† in g2 ; Eed  E1 , the edges which are deleted from g1 ; Eei  E2 , the edges which are inserted in g2 .

The cost of an ECGM is defined in terms of the cost cns , cnd , cni , ces , ced , and cei associated with the graph-edit operations. All costs are nonnegative real functions. Definition 4. The cost of an ECGM f : V^1 ! V^2 from a graph g1 ˆ …V1 ; E1 ; 1 ; 1 † to a graph g2 ˆ …V2 ; E2 ; 2 ; 2 † is given by X X X C…f† ˆ cns …x; f…x†† ‡ cnd …x† ‡ cni …x†‡ x2Vns

X

x2Ees

x2Vnd

ces …x; f…x†† ‡

X

x2Eed

x2Vni

ced …x† ‡

X

x2Eei

cei …x†:

VOL. 23, NO. 10,

OCTOBER 2001

1145

Definition 5. The distance of g1 to g2 is given by d…g1 ; g2 † ˆ minfC…f† j f is an ECGM from g1 to g2 g: The ECGM f with minimum cost is called optimal. Graph matching has been long investigated and as a result several alternative definitions of graph-distance function are known from the literature. Using the same fundamental idea of edit operations Sanfeliu and Fu [25] define a graph-distance function in a syntactic pattern recognition context. Shapiro and Haralick [27], [28] assume two graphs of identical cardinality; otherwise, dummy nodes can be added into the smaller one. Their graph-distance functions are based on measuring differences under a permutation of the nodes. The graph-edit distance function given in [30] is the same as ours except for node deletion/insertion. They require that the edges incident to a node x be explicitly deleted before x is deleted. Similarly, the edges incident to x must be explicitly inserted after x has been inserted. This distance function can actually be realized in our context by an adjustment of the node deletion/insertion cost to take account for the costs of explicitly deleting/inserting involved edges. Finally, several authors [3], [7], [29] propose graph-distance functions by computing the maximum common subgraph. Note that the computation of all these graph-distance functions is NP-complete and can only be done in exponential time. The choice of the graphdistance function is certainly dependent on the particular application and results in different median graphs in general. Our genetic algorithm for computing median graphs will be introduced using the distance function given in Definition 5. In Section 4.5, however, we will point out that our algorithm can be easily adapted to other graph-distance functions and is thus of some general nature. Trees are a class of special graphs and as such, they require special edit operations. A large amount of work has been proposed for comparing two trees based on various distance functions, see the recent publications [16], [23], [31] and the references therein. In some cases, the computation demand is only polynomial [16]. With appropriate modifications, the algorithm proposed in this paper is able to work on trees as well.

3 3.1

THEORETICAL CONSIDERATIONS ABOUT MEDIAN GRAPHS Computational Complexity

Computation of graph distance is a fundamental prerequisite to finding the generalized median and the set median of a given set of graphs. Since graph-distance computation is a well-known NP-complete problem, the computation of both types of median graphs can only be done in exponential time. Conceptually, searching for the set median graph of n input graphs is an easy task since it suffices to compute 12 n…n ÿ 1† pairwise graph distances. Due to the high expense of graph-distance computation, however, it is often desired to determine the set median graph more efficiently than under the naive approach. Some suggested methods for this purpose can be found in [13]. Determining the generalized median graph is computationally more complex. On the one hand, the computation time is clearly exponential in the size of the input graphs. On the other hand, it is also exponential in terms of the number of input graphs. The reason for this behavior is that already for the special case of strings, the required time is exponential in the number of input strings [9]. As a consequence, we are generally forced to resort to approximate solutions that can be found in reasonable time.

3.2

Bounds for Generalized Median Graphs

The generalized median g of a given set of graphs is certainly dependent on the underlying cost function. It is, however, easy to

1146

IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE, n! n 2 2 …n2 †!

VOL. 23,

NO. 10,

OCTOBER 2001

establish a lower and upper bound on the size of g that holds independent of the cost function.

Totally, there exist we obtain

Lemma 1. Let g ˆ …V ; E; ; † denote a generalized median graph of n given graphs S ˆ fgi ˆ …Vi ; Ei ; i ; i † j i ˆ 1; 2; . . . ; ng. Then,

Lemma 3. Let d…g1 ; g2 † be a metric. The true generalized median graph g of an even number n of input graphs S ˆ fg1 ; g2 ; . . . ; gn g satisfies n SOD…g†  max d…gl1 ; gl2 † ‡ d…gl3 ; gl4 † ‡    ‡ d…gl;nÿ1 ; gln † o j ……gl1 ; gl2 †; …gl3 ; gl4 †; . . . ; …gl;nÿ1 ; gln †† is a partition of S :

0  jV j 

n X

jVi j

iˆ1

holds. Proof. The lower bound is obvious. For the upper bound, we P assume jV j > niˆ1 jVi j. The optimal ECGM from g to each gi substitutes at most jVi j nodes by those of gi . Hence, totally, at P most niˆ1 jVi j nodes of g undergo the substitution operation. It follows that any other node of g must be deleted when optimally transforming g to the gi s. If we drop these nodes from g, we obtain g with the following property. SOD…g † ˆ

n X

d…g ; gi †