• Aucun résultat trouvé

Algorithme polynomial pour les graphes isomorphes, tous les cas

N/A
N/A
Protected

Academic year: 2021

Partager "Algorithme polynomial pour les graphes isomorphes, tous les cas"

Copied!
9
0
0

Texte intégral

(1)

HAL Id: hal-01822100

https://hal.archives-ouvertes.fr/hal-01822100v5

Preprint submitted on 26 Jan 2020

HAL

is a multi-disciplinary open access archive for the deposit and dissemination of sci- entific research documents, whether they are pub- lished or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers.

L’archive ouverte pluridisciplinaire

HAL, est

destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d’enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.

Algorithme polynomial pour les graphes isomorphes, tous les cas

Mohamed Mimouni

To cite this version:

Mohamed Mimouni. Algorithme polynomial pour les graphes isomorphes, tous les cas. 2020. �hal-

01822100v5�

(2)

Polynomial algorithm for isomorphic graphs, all cases

Mohamed mimouni

20 street kadissia 60000 Oujda Morocco mimouni.mohamed@gmail.com

January 26, 2020

Abstract

In this paper, I propose an algorithm capable of solving the problem of isomorphic graphs in polynomial time. First, I define a pseudo tree that allows us to define for each vertex a label or a label. Secondly, I apply the pseudo tree for the first graph then I calculate the labels of each vertex of the first graph, then I do the same for the second graph. Thirdly, I look for for each graph vertex1 the graph vertices2 which have the same label, if or less a first graph vertex its label is not in the second graph vertices we deduce that the two pseudo trees are not isomorphic. In other cases I generate solutions and check them in polynomial time...

This algorithm therefore allows isomorphic graphs to calculate the image of each vertex in polynomial time.

MOTS-CLES : isomorphic graphs, isomorphism, automorphism, hypergraphs, isomorphs

(3)

Contents

1 Definitions of the terms 3

1.1 A graph . . . 3

1.2 A hypergraph . . . 3

1.3 An isomorphism . . . 3

2 Building a pseudo tree 3 3 Label 3 4 Algorithme 3 4.1 For the graphG . . . 3

4.2 For the graphH . . . 3

5 Mathematical proof 4 5.1 principal theorem . . . 4

5.1.1 proof. . . 4

5.2 The algorithm. . . 4

5.2.1 The verification . . . 4

5.2.2 The complexity . . . 4

6 Algorithm complexity 4 7 Examples 5 7.1 connected graphs . . . 5

7.1.1 Pseudo tree of head a for graphG . . . 5

7.1.2 Label of each graph vertexG . . . 5

7.1.3 Pseudo tree of head 2,4,5 and 7 for graphH. . . 5

7.1.4 The labels . . . 5

7.1.5 Check the solutions . . . 6

8 pseudo codes 7 8.1 pseudo-arbres . . . 7

8.2 The label . . . 7

8.3 Validate a solution . . . 8

8.4 comment. . . 8

9 Conclusion 8

(4)

1 Definitions of the terms

1.1 A graph

A graph is a set of points called nodes (sometimes vertices or cells) connected by lines (segments) or arrows called edges (or links or bows).

1.2 A hypergraph

A hypergraph is a graph whose edges connect one or two or more vertices.

1.3 An isomorphism

An isomorphismf between the graphsGandHis a bijection between the vertices of Gand those of H, such as a pair of verticesu,vof Gis an edge of Gif and only if (u), (v) is an edge of H.

2 Building a pseudo tree

Let’s sayGa simple graph andsa vertex. The pseudo tree headersis done in the following way : 1. The vertexsin level 0.

2. The adjacents of sin level 1.

3. The adjacencies of each vertex of level 1 without repetition, which are not already in the other levels, in thelevel 2.

4. Repeat step 3 to build the other levels.

5. End when there are no new adjacent ones.

If in the case (case of not connected graph) where there are still graph vertices G, which are not in the pseudo-trees, other pseudo-trees must be generated.

3 Label

For each vertex ofGa label is formed of four elements : 1. nthe level it is at.

2. hthe number of adjacent ones who are in the upper level.

3. mthe number of adjacents who are in the same level.

4. bthe number of adjacent ones who are in the lower level.

4 Algorithme

Let’s sayGa graph{g1, g2, g3, , , gn} andHa graph{h1, h2, h3, , , hn}

The two graphsGandH are isomorphic if for the isomorphism functionf(gi) =hi, we have the label ofgi equals the label ofhi.

label(g) =label(h) = − − −

(5)

5 Mathematical proof

5.1 principal theorem

Let’s sayP(a) andQ(a) two pseudo isomorphic trees.

Iff(a) =a we have:

For each vertexsof P(a): label(s) =label(s)

5.1.1 proof

Isomorphism keeps the distance, therefore:

1. n=d(a, s) =d(a, f(s)) so f(s) is also in leveln.

2. forh, there arehvertices oflevel n-1adjacent tossuch asd(s, th) =d(s, th) andd(a, th) = d(a, th) =n−1, according to the definition there is alsohvertices inQ(a’)

3. form, there arem vertices of level nadjacent tos so d(s, tm) =d(s, tm) and d(a, tm) = d(a, tm) =n, according to the definition there are alsomvertices inQ(a’).

4. for b, there are bvertices of level n+1 adjacent to sso d(s, tb) = d(s, tb) and d(a, tb) = d(a, tb) =n+ 1, according to the definition there is alsobvertices inQ(a’) .

which shows thatlabel(s) =label(s)

5.2 The algorithm

According toprincipal theoremwe have two cases:

Case 1 label(s)6=label(s) =⇒f(s)6=s.

Case 2 label(s) =label(s), it is necessary to check f(s)=s’ (We can’t say thatf(s) =s)

5.2.1 The verification

So after finding for each vertex of Gone or more images of isomorphismf, we must do one last step: solution verification, this verification andpolynomial.

5.2.2 The complexity

All the steps of the algorithm are polynomial, so the algorithm proposed in this paper and Poly- nomial, sothe isomorphism is in P.

6 Algorithm complexity

Each vertex must be in a pseudo-tree, so the complexity isO(n2).

For the second graph the complexity can reachO(n3).

The calculation of the labels of each vertex isO(n).

The solution validation is toO(n3).

So this algorithm is polynomial.

(6)

7 Examples

7.1 connected graphs

Either the two graphsGandH, present by lists of the following adjacents:

GraphG GraphH a:b,d,e,h 1:4,6,7,8,9 b:a,c,e,g,i 2:6,7,8,9 c:b,f,g,h,i 3:5,6 d:a,e,f,i 4:1,5,6,9 e:a,b,d,h,i 5:3,4,7,9 f:c,d 6:1,2,3,4,8 g:b,c,h 7:1,2,5,9 h:a,c,e,g 8:1,2,6 i:b,c,d,e 9:1,2,4,5,7

7.1.1 Pseudo tree of head a for graph G GraphG levels

a level 0

b,d,e,h level 1 f,i,c,g level 2

7.1.2 Label of each graph vertex G

vertex adjacent level top even bottom label

a b,d,e,h 0 empty a b,d,e,h 0-0-0-4

b a,c,e,g,i 1 a b,d,e,h f,i,c,g 1-1-1-3

d a,e,f,i 1 a b,d,e,h f,i,c,g 1-1-1-2

e a,b,d,h,i 1 a b,d,e,h f,i,c,g 1-1-3-1

h a,c,e,g 1 a b,d,e,h f,i,c,g 1-1-1-2

f c,d 2 b,d,e,h f,i,c,g empty 2-1-1-0

i b,c,d,e 2 b,d,e,h f,i,c,g empty 2-3-1-0 c b,f,g,h,i 2 b,d,e,h f,i,c,g empty 2-2-3-0 g b,c,h 2 b,d,e,h f,i,c,g empty 2-2-1-0

explanations After finishing for graphG, we move on to graphH: Label (a)=0-0-0-0-4 so for graphH, we test f(a)=2, f(a)=4, f(a)=5 and f(a)=7.

7.1.3 Pseudo tree of head 2,4,5 and 7 for graph H

2 4 5 7 level 0 a

6,7,8,9 1,5,6,9 3,4,7,9 1,2,5,9 level 1 b,d,e,h 3,1,4,5 3,8,2,7 6,1,2 6,8,3,4 level 2 f,i,c,g

8 level 3

We are forward to vertex 5 four levels sof(a)6= 5.

7.1.4 The labels

vertex adjacent level top same bottom label images

(7)

head 7

vertex adjacent level top same bottom label images

7 1,2,5,9 0 empty 7 1,2,5,9 0-0-0-4 a

1 4,6,7,8,9 1 7 1,2,5,9 6,8,3,4 1-1-1-3 b

2 6,7,8,9 1 7 1,2,5,9 6,8,3,4 1-1-1-2 d,h

5 3,4,7,9 1 7 1,2,5,9 6,8,3,4 1-1-1-2 d,h

9 1,2,4,5,7 1 7 1,2,5,9 6,8,3,4 1-1-3-1 e 6 1,2,3,4,8 2 1,2,5,9 6,8,3,4 empty 2-2-3-0 c 8 1,2,6 2 1,2,5,9 6,8,3,4 empty 2-2-1-0 g

3 5,6 2 1,2,5,9 6,8,3,4 empty 2-1-1-0 f

4 1,5,6,9 2 1,2,5,9 6,8,3,4 empty 2-3-1-0 i

7.1.5 Check the solutions

vertex adjacent images images adjacent vertex adjacent state

7 1,2,5,9 a (b),(d,h),(d,h),(e) a b,d,e,h ok

1 4,6,7,8,9 b (i),(c),(a),(g),(e) b a,c,e,g,i ok

2 6,7,8,9 d (c),(a),(g),(e) d a,e,f,i no

2 6,7,8,9 h (c),(a),(g),(e) h a,c,e,g ok

5 3,4,7,9 d (f),(i),(a),(e) d a,e,f,i ok

5 3,4,7,9 h (f),(i),(a),(e) h a,c,e,g no

9 1,2,4,5,7 e (b),(d,h),(i),(d,h),(a) e a,b,d,h,i ok 6 1,2,3,4,8 c (b),(d,h),(f),(i),(g) c b,f,g,h,i ok

8 1,2,6 g (b),(d,h),(c) g b,c,h ok

3 5,6 f (d,h),(c) f c,d ok

4 1,5,6,9 i (b), (d,h),(c),(e) i b,c,d,e ok

explanations In this table we havef(2) =hand not d. andf(5) =dand not h.

The check to give 2 errors, we must then do another check

vertex adjacent images images adjacent vertex adjacent state

7 1,2,5,9 a (b),(,h),(d),(e) a b,d,e„h ok

1 4,6,7,8,9 b (i),(c),(a),(g),(e) b a,c,e,g,i ok

2 6,7,8,9 h (c),(a),(g),(e) h a,c,e,g ok

5 3,4,7,9 d (f),(i),(a),(e) d a,e,f,i ok

9 1,2,4,5,7 e (b),(,h),(i),(d),(a) e a,b,d„h,i ok 6 1,2,3,4,8 c (b),(,h),(f),(i),(g) c b,f,g„h,i ok

8 1,2,6 g (b),(,h),(c) g b,c„h ok

3 5,6 f (d),(c) f c,d ok

4 1,5,6,9 i (b),(d),(c),(e) i b,c,d,e ok

explanations Now with no errors so both graphsGandH are isomorphic and here is the final solution:

vertex Image

a 7

b 1

c 6

d 5

e 9

f 3

g 8

h 2

i 4

(8)

8 pseudo codes

8.1 pseudo-arbres

Here is a pseudo code that generates a pseudo tree.

Algorithm 1:generate a pseudo treeP(a) heada for a graphG Data: A graphGand a vertexa of G

Result: A pseudo treeP(a)

1 initialization; the vertexa in thelevel 0;

2 the adjacentfrom a inlevel 1;

3 the vertices of Gin arraygraph[];

4 delete the vertices of thelevel 0and1arraygraph[];

5 niv←1 ;

6 adjacents←adjacent toa;

7 whilegraph[]is not empty do

8 initialize arraylist[]empty ;

9 nivniv+ 1 ;

10 forevery elementof adjacent do

11 adjacents1←the adjacents of element;

12 adjacents1←the intersections between adjacent1 and graph[] ;

13 liste[]←list[]+adjacents1 ;

14 liste[]liste[] order and without duplication ;

15 graph[]←the difference between graph[]andlist[];

16 if graph[] is emptythen

17 break;

18 end

19 end

20 if lise[] is emptythen

21 break;

22 else

23 list in levelniv;

24 end

25 end

For unconnected graphs, it is necessary to generate other pseudo-trees for the other remaining vertices.

8.2 The label

Here’s a pseudo code that calculates the label of a vertex in a pseudo tree.

Algorithm 2:Calculate the label of a vertex sin a pseudo tree Data: A vertexsin a pseudo tree

Result: slabel for a pseudo tree

1 n←determine the level of s;

2 nivh←determine the vertices that are in the level n+1;

3 nivm←determine the vertices that are in the leveln;

4 nivb←determine the vertices that are in the level n-1;

5 h←the number of adjacent verticessthat are innivh;

(9)

8.3 Validate a solution

Here’s a pseudo code to check out a proposed solution.

Algorithm 3:Check a solution Data: A proposed solution

Result: validated or erroneous solution

1 initialization;

2 err←0;

3 forEach f(a)=a’ proposed do

4 adjacent(a)←the adjacent verticesa;

5 adjacent(a)←the adjacent verticesa’;

6 foreach adjacent to ado

7 x←an adjacent vertex adjacenta;

8 x ←the images of xby isomorphism;

9 Intersection←the intersection between the images of xby isomorphism and the adjacent ones of a’;

10 if intersection is empty then

11 err←err+1;

12 break;

13 end

14 end

15 if err6= 0then

16 break;

17 end

18 end

19 if err= 0then

20 "The solution is validated";

21 else

22 "The solution is not validé";

23 end

8.4 comment

For the not connected graphs it is necessary of course to study the isomorph between the connected components.

9 Conclusion

In this paper I presented a version of a polynomial algorithm, which gives us the images of each vertices by isomorphic bijection, or to say that the two graphs are not isomorphic.

Références

Documents relatifs

3.3.3 Unicyclic graphs with exactly three vertices of maximum degree 3 whose exactly two belongs to the

For each data set, we can compute a graph where the weights are computed by the the euclidean distance in, respectively, the initial space and the learned space for LMNN

Input: initial partition P A clp on a subgraph Constraint: vertices in P A clp should remain fixed Output: partition P A of the whole graph. Input: initial partition P A on the

The fractional chromatic number of a graph G can indeed be defined to be the infimum (which actually is a minimum) of the ratios a/b such that, if every vertex of G is replaced by

Biometric identification consists in finding an unknown identity (the probe image) among a set of known identities (the gallery). Most of the approaches proposed in the lit-

The operator we are interested in is the graph translation [9] defined in the Fourier domain as an iso- metric operator shifting the Fourier components by a complex phase and

In this paper, we give a formal statement which expresses that a simple and local test performed on every node before its construction permits to avoid the construction of useless

At the end of the paper, we also prove a general result ensuring that any strongly reinforced VRRW on any bounded degree graph localizes a.s.. Then the following