AN HEURISTIC FOR GRAPH SYMMETRY DETECTION 1. Introduction ...

1 downloads 0 Views 261KB Size Report
HUBERT DE FRAYSSEIX. Abstract. We give a short introduction to an heuristic to nd automorphisms in a graph such as axial, central or rotational symmetries.
AN HEURISTIC FOR GRAPH SYMMETRY DETECTION HUBERT DE FRAYSSEIX

Abstract. We give a short introduction to an heuristic to nd automorphisms in a graph such as axial, central or rotational symmetries. Using technics of factorial analysis, we embed the graph in an Euclidean space and try to detect and interpret the geometric symmetries of of the embedded graph.

1. Introduction Testing whether a graph has any axial (rotational, central, respectively) symmetry is a NP-complete problem [9]. Some restrictions (central symmetry with exactly one xed vertex and no xed edge) are polynomialy equivalent to the graph isomorphism test. Notice that this latter problem is not known to be either polynomial or NP-complete in general. But several heuristics are known (e.g. [3]) and several restrictions leads to ecient algorithms: linear time isomorphism test for planar graphs [6] and interval graphs [8], polynomial time isomorphism test for xed genus [10, 5], k-contractible graphs [12] and pairwise k-separable graphs [11], linear axial symmetry detection for planar graphs with a given embedding. In the context of automatic generation of industrial diagrams, the aim of symmetry display is not only to get a 'nice' drawing but also to enlight some of the semantic of the design. Usually the given networks are not planar and even so, due to other constraints (even aesthetics ones), crossings are very common. We present here the main outlines of an heuristic to detect symmetries. It will R but has soon be integrated in PICTEL, our diagram drawing module of CATIA 1 already been integrated in our research graph drawing toolkit PIGALE Our main idea to exhibit the symmetries of a graph (planar or not) is to de ne a distance among the vertices of the graph and embed it isometrically in R ?1 , where n is the order of the graph. Then detecting the symmetries of the graph mainly reduces to nding the geometric symmetries of the embedded graph and checking that they do corresponds to automorphisms of the given graph. n

2. Automorphisms and Symmetries An automorphism of G = (V; E ) is a permutation  of V and E , such that:  (E ) = E;  (V ) = V;  e 2 E is incident to v 2 V () (e) is incident to (v) The usual meaning given to axial, central and rotational symmetry is strongly related to a drawing of a graph. We shall say that such symmetries exist if and only if there exists a drawing of the graph in the plane (with eventually crossings) in such a way that a usual axial, central or rotational symmetry appears. A central symmetry is an involutive automorphism  2 Aut(G), such that the xed points set of  is either included in E or reduced to a single vertex. This work was partially supported by the Esprit LTR Project no 20244-ALCOM IT. 0 CATIA is a registered trade mark of IBM 1 PIGALE is a Public Implementation of a Graph Algorithm Library and Editor which is available by anonymous ftp at ftp://pr.cams.ehess.fr/pub/pigale.tgz 1

2

HUBERT DE FRAYSSEIX

A rotational symmetry is an automorphism  2 Aut(G), which cycles are all of the same length (greater than two) and such that the xed points set or  is either empty of reduce to a single vertex. An axial symmetry is an involutive automorphism  2 Aut(G), such that the subgraph of G induced by the xed points set of  is embeddable on a line. 3. The Embedding Model We shall recall some very basic methods used in Factorial Analysis applied to the study of statistical data. 3.1. Euclidean distances. Let X be a set of n points and d a distance among them. The distance d is Euclidean, if there exists an embedding of X in R ?1 such that the restriction of the usual distance in R ?1 coincides with the given distance d on X . Given a distance d on a set X , it is classical to de ne the corresponding innerproduct matrix W de ne by the formula:  1? (1) W = d2 (v ;  ) + d2 (v ;  ) ? d2 ( ;  ) 2 where 1 X d2 (v ; v ) d2 (v ;  ) = n

n

i

i;j

j

n

n j =1

i

i

j

n 1X d2 ( ;  ) = d2 (vi ;  ) n i=1

It is well known that the distance d is Euclidean if and only if the matrix W is diagonalizable [1][7]. In such a case W de nes a positive semi-de nite bilinear form, that is all its eigenvalues are positive or null. The maximum of non null eigenvalues is n ? 1 (bound corresponding to the maximal dimension of the vector space generated by n points). If we denote by F1 ; : : : ; F an orthonormal basis of eigenvectors associated to the strictly positive eigenvalues 1 ; : : : ;  , we have: p

p

d2 (vi ; vj ) =

(2)

p X

k

=1

k (Fi;k ? Fjk )2

3.2. De ning a distance in a graph. One of the rst natural distance one could think to de ne a distance between vertices of a graph, would be to consider the length of the shortest paths joining them. But even the complete graph on 4 vertices with one edge deleted proves that shortest paths do not de ne an Euclidean distance. Many mathematical statisticians have de ne Euclidean distances on abstract sets. But from previous work, while supervising P. Kunz's thesis [7] on the problem of partitioning large graphs into a given number of subgraphs [4], the so called Czekanovski-Dice distance seemed to be very appropriate to reveal the structure of a graph. With respect to that distance, two vertices are close to each other if they have many common vertices: For each pair (v ; v ) of vertices, we denote N the set of the neighbors of v : N = fv 2 V; (v ; v ) 2 E g [ fv g Then, the distance d is de ned by: i

j

i

i

(3)

k

d2 (vi ; vj ) =

i

i

j

i

jN 4 N j jN j + jN j i

i

j

j

AN HEURISTIC FOR GRAPH SYMMETRY DETECTION

3

where 4 denotes the symmetrical set-di erence. Notice that the distances are obviously preserved by any automorphism of the graph: Remark that a pair of non adjacent vertices having no common neighbor are at distance 1, and two adjacent vertices having the same neighbors are at distance 0. Therefore there are non-isomorphic graphs having the same distances between their vertices. 3.3. Embedding and projecting the graph. The rst step of the heuristic is to compute the Czekanovski-Dice distance among the vertices of the graph and the corresponding inner-product matrix W . As the Czekanovski-Dice distance is Euclidean, we can diagonalise W whose eigenvalues are all positive or null. Unless G is a complete graph, the rank of W is not null, and if G has more than 2 vertices its rank is at least 2, but if there are many pairs of vertices with the same neighbors, the rank of W decreases and we get many null eigenvalues. We then compute an orthonormal basis and compute the p coordinates of all the vertices corresponding to the p strictly positive eigenvalues. We then sort the axes in decreasing order according to the value of their corresponding eigenvalue. Using the terminology of mechanics, The origin is the inertia center, the axes are the principal axes of the set of points and the inertia along each axe decrease with respect to that order. The main tool of Factorial Analysis is precisely to study the projections of the points on the rst axes which re ects the main distances structure. So the next step of the heuristic then consists in looking at the geometric symmetries that may appear when projecting the points on the planes de ned by the rst axes. 4. The Heuristic by examples Paradoxally, it is far easier to nd a symmetry in a graph with a small automorphism group (when one exists!). If it is not the case, there are many geometric symmetries in the embedded graph and many equal eigenvalues (e.g the Petersen graphs has, among its nine eigenvalues, only two distinct ones). If an eigenvalue has a multiplicity greater than one, there is no canonical way to compute the corresponding eigenvectors and heuristics have to be designed to select the most appropriate ones such that in some plane de ned by them a geometrical symmetry appears. To simplify the following discussion, we assume the graph connected. 4.1. All the eigenvalues are distinct. This is the easiest case, as all the principal axes are uniquely determined. In all the cases we encountered, it is only necessary to check for an geometric axial symmetry of the graph projected on the rst two principal axes (x,y). Depending on the number of edges between the two isomorphic graphs de ned by the axial symmetry, the geometric symmetry appears on the y-axis or the x-axis. The points with null coordinates are the xed points, and the other points split into two sets (the one with positive x-coordinates and the ones with x-negative coordinates). Usually the geometric symmetry is de ned by the y axis: the xed points are the points with null x-coordinate, and the two isomorphic graphs are de ned by the points of positive (resp. negative x-coordinates). If no two points have the same x-coordinate, the identi cation of the corresponding symmetric vertices is trivial. Otherwise the third axis usually breaks the ambiguities. In a few cases, the edges joining the xed points, were not a chain subgraph (i.e. the axial symmetry detection fails) but we do hope to solve this problem by doing a closer analysis of the xed points set. We never found an example where geometric symmetry did not correspond to an automorphism of the graph. Figure 1 is a typical example where the rst eigenvalues are distinct. The image on

4

HUBERT DE FRAYSSEIX

Figure 1. A non-planar graph with only an axial symmetry

the left side represents the projection on the rst two principal axes, and on the right side we show the graph where the vertices have been relabelled according to the symmetry. The drawings of the planar graphs use the so-called Tutte-Circle algorithm of PIGALE (the postscript les were created by the LEDA library). 4.2. The rst two eigenvalues has multiplicity two. In such a case, we highly suspect the existence of a central symmetry or a rotational symmetry. For a central symmetry, we only have to check that there at most one point with x and y null coordinates and that the points have a central symmetry. Then we try to exhibit a rotational symmetry. This is also very simple: we consider the points which are at maximal distance of the origin and sort them according to their polar angle and we try to match them by rotations. If we succeed, we check that the matching extends to all the points. If we nd a central or rotational symmetry, we try to exhibit an axial symmetry. As the two rst eigenvalues are equal, the position of the rst axes depend on the labelling of the vertices and has nothing to do with its structure. So we really need an heuristic to nd out a rotation of the rst two axes such that a geometrical axial symmetry appears along one of those axes in the plane they de ne. We are far from having an algorithm that we could guaranty. Nevertheless, we do have heuristics that has been ecient in all the cases we met. It is probably due to the fact that it is conceivable that not all realizations with a rotational symmetrie can be produced by a factorial analysis. Figure 2, Figure 3, Figure 4 gives examples where the rst eigenvalue is multiple. The Factorial Analysis drawings (left of the pictures) are done after the correct rotation of the axes has been applied. (We only show one or two symmetries found by the heuristic). 4.3. General Case. If the rst eigenvalue has multiplicity one, and the second one has multiplicity two, we are more or less in the previous situation. As we said earlier, if two vertices have the same neigbors, they have the same coordinates. It does not imply that we get a null eigenvalue, but if we have two distinct pair of vertices with the same neighbors, we do get null eigenvalues. If we do have many null eigenvalues, we probably could nd interesting automorphisms Otherwise, we do have examples where our heuristic completely fails (e.g. Petersen graph, complete bipartite graphs etc).

AN HEURISTIC FOR GRAPH SYMMETRY DETECTION

Figure 2. A planar graph with rotational and axial symmetry

Figure 3. A grid graph with one of its axial symmetries

Figure 4. A grid graph with a central symmetry (axes 3-1)

5

6

HUBERT DE FRAYSSEIX

Figure 5. The Folkman graph and its Factorial Analysis

Figure 6. Two other Factorial Analysis

4.4. More pictures. The following pictures, represent famous graphs taken from Examples and Counterexamples in Graph Theory [2]:  Figure 5 represents the Folkman graph.  Figure 6 On the left, a graph whose automorphism group is the Klein 4-group, and the Robertson graph (i.e. the (4,5)-cage) with a rotational symmetry. 4.5. Concluding Remarks. Sometimes, a geometric axial symmetry only reveals an automorphism as the set of xed points may not be a subgraph of a chain. This happens very often when the graph is a tree, but we shall implement the linear time algorithm to exhibit axial symmetries in such cases. As stated before, the heuristic often fails if the rst eigenvalues have a great multiplicity. Otherwise this heuristic seems very e ective and do nd symmetries on the examples we found in the algorithmic literature on that subject. The overall complexity of the heuristic is O(n3 ), (i.e. the complexity of the computation of the eigenvalues). It certainly could be improved, but that was not our main goal. The di erent heuristics to identify the isomorphic subgraphs, compute the rotations etc are either linear or in O(n log n). To give a rough idea of the time computation, on a Pentium running at 200 Mz, nding a symmetry in

AN HEURISTIC FOR GRAPH SYMMETRY DETECTION

7

a graph with 100 vertices takes .45 seconds and in a graph with 400 vertices 32 seconds. Acknowledgment. The author would like to express his gratitude to J. Benzcri who introduced him the Factorial Analysis technics and to P. Ossona de Mendez for his helpful remarks. References [1] J.P. Benzecri and et al, L'analyse des donnees | Tome II: l'analyse des correspondances, Dunod, Paris, 1973. [2] M. Capobianco, Examples and counterexamples in graph theory, Elsevier, North Holland, New-York, 1978. [3] D.G. Corneil and C.C. Gotlieb, An ecient algorithm for graph isomorphism, Journal of the ACM 17 (1970), no. 1, 51{64. [4] H. de Fraysseix and Kuntz P., Pagination of large scale networks, Algorithms review 2 (1992), no. 3, 105{112. [5] I.S. Filotti and J.N. Mayer, A polynomial-time algorithm for determining the isomorphism of graphs of xed genus (working paper), Conference Proceedings of the Twelfth Annual ACM Symposium on Theory of Computing (Los Angele, California), 1980, pp. 236{243. [6] J.E. Hopcroft and J.K. Wong, Linear time algorithm for isomorphism of planar graphs (preliminary report), Conference Record of Sixth Annual ACM Symposium on Theory of Computing (Seattle, Washington), 1974, pp. 172{184. [7] P. Kuntz, Representation euclidienne d'un graphe en vue de sa segmentation, Ph.D. thesis, Ecole des Hautes Etudes en Sciences Sociales, Paris, 1992. [8] G.S. Lueker and S.B. Kellogg, A linear time algorithm for deciding interval graph isomorphism, Journal of the ACM 26 (1979), no. 2, 183{195. [9] J. Manning, Geometric symmetry in graphs, Ph.D. thesis, Purdue University, New York, 1990. [10] G.L. Miller, Isomorphism testing for graphs of bounded genus, Conference Proceedings of the Twelfth Annual ACM Symposium on Theory of Computing (Los Angeles, California), 1980, pp. 225{235. , Isomorphism of graphs which are pairwise k-separable, Information and Control 56 [11] (1983), no. 1/2, 21{33. [12] , Isomorphism of k-contractible graphs. a generalization of bounded valence and bounded genus, Information and Control 56 (1983), no. 1/2, 1{20.

Hubert de Fraysseix, CNRS UMR 0017, E.H.E.S.S., 54 Bd Raspail, 75006 Paris, France E-mail address :

[email protected]

Suggest Documents