SlideShare a Scribd company logo
Polynomial algorithm for isomorphic graphs, all cases
Mohamed mimouni
20 street kadissia 60000 Oujda Morocco
mimouni.mohamed@gmail.com
April 12, 2019
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
1
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 graph G . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
4.2 For the graph H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 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 graph G . . . . . . . . . . . . . . . . . . . . . . . 5
7.1.2 Label of each graph vertex G . . . . . . . . . . . . . . . . . . . . . . . . . . 5
7.1.3 Pseudo tree of head 2,4,5 and 7 for graph H . . . . . . . . . . . . . . . . . . 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
2
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 isomorphism f between the graphs G and H is a bijection between the vertices of G and those
of H, such as a pair of vertices u, v of G is an edge of G if and only if (u), (v) is an edge of H.
2 Building a pseudo tree
Let’s say G a simple graph and s a vertex. The pseudo tree header s is done in the following way :
1. The vertex s in level 0.
2. The adjacents of s in level 1.
3. The adjacencies of each vertex of level 1 without repetition, which are not already in the
other levels, in the level 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 of G a label is formed of four elements :
1. n the level it is at.
2. h the number of adjacent ones who are in the upper level.
3. m the number of adjacents who are in the same level.
4. b the number of adjacent ones who are in the lower level.
4 Algorithme
Let’s say G a graph {g1, g2, g3, , , gn} and H a graph {h1, h2, h3, , , hn}
The two graphs G and H are isomorphic if for the isomorphism function f(gi) = hi, we have the
label of gi equals the label of hi.
label(gi) = label(hi) = n − h − m − b
4.1 For the graph G
Construct one or more pseudo-trees folds so as to have a label for each vertex of the graph G.
4.2 For the graph H
Build pseudo trees and calculate labels for each vertex of H. Search in the graph G vertices that
have the same label. If at least one vertex of H has an unequal label of the labels of the vertices
of H, the header is modified and the labels of the vertices of H. If each vertex of H has a label
equal to graph labels G, we do a validation or verification of the solutions. If the solution is not
validated, the headers are changed. End if a solution is validated or check.
3
5 Mathematical proof
5.1 principal theorem
Let’s say P(a) and Q(a ) two pseudo isomorphic trees.
If f(a) = a we have:
For each vertex s of 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 level n.
2. for h, there are h vertices of level n-1 adjacent to s such as d(s, th) = d(s , th) and d(a, th) =
d(a , th) = n − 1, according to the definition there is also h vertices in Q(a’)
3. for m, there are m vertices of level n adjacent to s so d(s, tm) = d(s , tm) and d(a, tm) =
d(a, tm) = n, according to the definition there are also m vertices in Q(a’).
4. for b, there are b vertices of level n+1 adjacent to s so d(s, tb) = d(s , tb) and d(a, tb) =
d(a , tb) = n + 1, according to the definition there is also b vertices in Q(a’) .
which shows that label(s) = label(s)
5.2 The algorithm
According to principal theorem we have two cases:
Case 1 label(s) = label(s ) =⇒ f(s) = s .
Case 2 label(s) = label(s ), it is necessary to check f(s)=s’ (We can’t say that f(s) = s )
5.2.1 The verification
So after finding for each vertex of G one or more images of isomorphism f, we must do one last
step: solution verification, this verification and polynomial.
5.2.2 The complexity
All the steps of the algorithm are polynomial, so the algorithm proposed in this paper and Poly-
nomial, so the isomorphism is in P.
6 Algorithm complexity
Each vertex must be in a pseudo-tree, so the complexity is O(n2
).
For the second graph the complexity can reach O(n3
).
The calculation of the labels of each vertex is O(n).
The solution validation is to O(n3
).
So this algorithm is polynomial.
4
7 Examples
7.1 connected graphs
Either the two graphs G and H, present by lists of the following adjacents:
Graph G Graph H
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
Graph G 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 graph G, we move on to graph H : Label (a)=0-0-0-0-4 so for
graph H, 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 so f(a) = 5.
7.1.4 The labels
head 2
vertex adjacent level top same bottom label images
2 6,7,8,9 0 empty 2 6,7,8,9 0-0-0-4 a
6 1,2,3,4,8 1 2 6,7,8,9 3,1,4,5 1-1-1-2 d,h
7 1,2,5,9 1 2 6,7,8,9 3,1,4,5 1-1-1-2 d,h
8 1,2,6 1 2 6,7,8,9 3,1,4,5 1-1-1-1 empty
At the vertex 8, the label (1-1-1-1-1) does not exist in graph labels G, so f(a) = 2.
head 4
vertex adjacent level top same bottom label images
4 1,5,6,9 0 empty 4 1,5,6,9 0-0-0-4 a
1 4,6,7,8,9 1 4 1,5,6,9 3,8,2,7 1-1-2-2 empty
For vertex 1 the label (1-1-2-2) does not exist in the graph labels G, so f(a) = 4.
5
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 have f(2) = h and not d. and f(5) = d and 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 graphs G and H 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
6
8 pseudo codes
8.1 pseudo-arbres
Here is a pseudo code that generates a pseudo tree.
Algorithm 1: generate a pseudo tree P(a) head a for a graph G
Data: A graph G and a vertex a of G
Result: A pseudo tree P(a)
1 initialization; the vertex a in the level 0;
2 the adjacent from a in level 1;
3 the vertices of G in array graph[];
4 delete the vertices of the level 0 and 1 array graph[];
5 niv ← 1 ;
6 adjacents ← adjacent to a ;
7 while graph[] is not empty do
8 initialize array list[] empty ;
9 niv ← niv + 1 ;
10 for every element of 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[] and list[] ;
16 if graph[] is empty then
17 break;
18 end
19 end
20 if lise[] is empty then
21 break;
22 else
23 list in level niv ;
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 s in a pseudo tree
Data: A vertex s in a pseudo tree
Result: s label 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 level n;
4 nivb ← determine the vertices that are in the level n-1;
5 h ← the number of adjacent vertices s that are in nivh;
6 m ← the number of adjacent vertices s that are in nivm;
7 b ← the number of adjacent vertices s that are in nivb;
8 label(s) ← "n-h-m-b";
7
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 for Each f(a)=a’ proposed do
4 adjacent(a) ← the adjacent vertices a;
5 adjacent(a ) ← the adjacent vertices a’;
6 for each adjacent to a do
7 x ← an adjacent vertex adjacent a;
8 x ← the images of x by isomorphism;
9 Intersection ← the intersection between the images of x by 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 err = 0 then
16 break;
17 end
18 end
19 if err = 0 then
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.
8

More Related Content

PDF
X maths 1
PDF
Ebook 1
PDF
Algebra 2 Section 1-2
PDF
Cs6702 graph theory and applications Anna University question paper apr may 2...
PDF
Cs6702 GCC
PDF
3.complex numbers Further Mathematics Zimbabwe Zimsec Cambridge
PDF
Surds,
PDF
Geometry Section 2-8
X maths 1
Ebook 1
Algebra 2 Section 1-2
Cs6702 graph theory and applications Anna University question paper apr may 2...
Cs6702 GCC
3.complex numbers Further Mathematics Zimbabwe Zimsec Cambridge
Surds,
Geometry Section 2-8

What's hot (20)

PDF
Higher paper 2__november_2013
PDF
Ακολουθίες - Α.Π - Γ.Π 2021
PDF
Ats maths09
PDF
International Refereed Journal of Engineering and Science (IRJES)
PDF
Merrk
DOCX
Cs6702 graph theory and applications question bank
PDF
Tenth class-state syllabus-model paper-em-ap-mathematics
DOCX
05 practice paper_3_h_set_a
PPTX
43literal equations
PDF
ملزمة الرياضيات للصف السادس التطبيقي الفصل الاول الاعداد المركبة 2022
PDF
Chapter 1 Functions Relations V3
DOC
Algebreviewer
PDF
Ch 5 con and diff
PDF
Algebra 2 Section 1-1
DOCX
Biseccion
PDF
SAT Math: It's All About The Question
PDF
Chapter0
PDF
Kertas Percubaan SPM Kedah add-maths p2 2017
PPTX
IIT JEE - 2007 ii - mathematics
DOCX
End of module 3 review
Higher paper 2__november_2013
Ακολουθίες - Α.Π - Γ.Π 2021
Ats maths09
International Refereed Journal of Engineering and Science (IRJES)
Merrk
Cs6702 graph theory and applications question bank
Tenth class-state syllabus-model paper-em-ap-mathematics
05 practice paper_3_h_set_a
43literal equations
ملزمة الرياضيات للصف السادس التطبيقي الفصل الاول الاعداد المركبة 2022
Chapter 1 Functions Relations V3
Algebreviewer
Ch 5 con and diff
Algebra 2 Section 1-1
Biseccion
SAT Math: It's All About The Question
Chapter0
Kertas Percubaan SPM Kedah add-maths p2 2017
IIT JEE - 2007 ii - mathematics
End of module 3 review
Ad

Similar to Isomorphespolynomial eng (20)

PDF
Graphtheory
PDF
Graph theory
PDF
Graph Dynamical System on Graph Colouring
PDF
DATA STRUCTURES & ALGORITHMS MINIMUM SPANNING TREE
PDF
Lego like spheres and tori, enumeration and drawings
PDF
Exhaustive Combinatorial Enumeration
PDF
6 CSE551 PavelGreedy5_v3 - Tagged.pdf it
PPTX
Graph Analytics - From the Whiteboard to Your Toolbox - Sam Lerma
DOCX
Cs6660 compiler design november december 2016 Answer key
PPTX
Attributed Graph Matching of Planar Graphs
PDF
Bounded Approaches in Radio Labeling Square Grids -- Dev Ananda
PDF
Theta θ(g,x) and pi π(g,x) polynomials of hexagonal trapezoid system tb,a
PDF
Independence Complexes
PDF
Feedback Vertex Set
PPT
Cryptography and Network Security chapter 4.ppt
ODP
Minimizing cost in distributed multiquery processing applications
PPT
PPTX
Quadratic Functions graph
PDF
A Hypocoloring Model for Batch Scheduling Problem
PDF
Introdution to differential forms
Graphtheory
Graph theory
Graph Dynamical System on Graph Colouring
DATA STRUCTURES & ALGORITHMS MINIMUM SPANNING TREE
Lego like spheres and tori, enumeration and drawings
Exhaustive Combinatorial Enumeration
6 CSE551 PavelGreedy5_v3 - Tagged.pdf it
Graph Analytics - From the Whiteboard to Your Toolbox - Sam Lerma
Cs6660 compiler design november december 2016 Answer key
Attributed Graph Matching of Planar Graphs
Bounded Approaches in Radio Labeling Square Grids -- Dev Ananda
Theta θ(g,x) and pi π(g,x) polynomials of hexagonal trapezoid system tb,a
Independence Complexes
Feedback Vertex Set
Cryptography and Network Security chapter 4.ppt
Minimizing cost in distributed multiquery processing applications
Quadratic Functions graph
A Hypocoloring Model for Batch Scheduling Problem
Introdution to differential forms
Ad

Recently uploaded (20)

PPTX
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
PDF
Votre score augmente si vous choisissez une catégorie et que vous rédigez une...
PPTX
SAP 2 completion done . PRESENTATION.pptx
PPTX
importance of Data-Visualization-in-Data-Science. for mba studnts
PPTX
Leprosy and NLEP programme community medicine
PDF
Capcut Pro Crack For PC Latest Version {Fully Unlocked 2025}
PPTX
A Complete Guide to Streamlining Business Processes
PDF
Business Analytics and business intelligence.pdf
PPTX
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
PPTX
Copy of 16 Timeline & Flowchart Templates – HubSpot.pptx
PPTX
sac 451hinhgsgshssjsjsjheegdggeegegdggddgeg.pptx
PPTX
New ISO 27001_2022 standard and the changes
PDF
Systems Analysis and Design, 12th Edition by Scott Tilley Test Bank.pdf
PPTX
QUANTUM_COMPUTING_AND_ITS_POTENTIAL_APPLICATIONS[2].pptx
PPTX
STERILIZATION AND DISINFECTION-1.ppthhhbx
PPTX
(Ali Hamza) Roll No: (F24-BSCS-1103).pptx
PPTX
Introduction to Inferential Statistics.pptx
PDF
Transcultural that can help you someday.
PPTX
Managing Community Partner Relationships
PDF
REAL ILLUMINATI AGENT IN KAMPALA UGANDA CALL ON+256765750853/0705037305
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
Votre score augmente si vous choisissez une catégorie et que vous rédigez une...
SAP 2 completion done . PRESENTATION.pptx
importance of Data-Visualization-in-Data-Science. for mba studnts
Leprosy and NLEP programme community medicine
Capcut Pro Crack For PC Latest Version {Fully Unlocked 2025}
A Complete Guide to Streamlining Business Processes
Business Analytics and business intelligence.pdf
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
Copy of 16 Timeline & Flowchart Templates – HubSpot.pptx
sac 451hinhgsgshssjsjsjheegdggeegegdggddgeg.pptx
New ISO 27001_2022 standard and the changes
Systems Analysis and Design, 12th Edition by Scott Tilley Test Bank.pdf
QUANTUM_COMPUTING_AND_ITS_POTENTIAL_APPLICATIONS[2].pptx
STERILIZATION AND DISINFECTION-1.ppthhhbx
(Ali Hamza) Roll No: (F24-BSCS-1103).pptx
Introduction to Inferential Statistics.pptx
Transcultural that can help you someday.
Managing Community Partner Relationships
REAL ILLUMINATI AGENT IN KAMPALA UGANDA CALL ON+256765750853/0705037305

Isomorphespolynomial eng

  • 1. Polynomial algorithm for isomorphic graphs, all cases Mohamed mimouni 20 street kadissia 60000 Oujda Morocco mimouni.mohamed@gmail.com April 12, 2019 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 1
  • 2. 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 graph G . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 4.2 For the graph H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 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 graph G . . . . . . . . . . . . . . . . . . . . . . . 5 7.1.2 Label of each graph vertex G . . . . . . . . . . . . . . . . . . . . . . . . . . 5 7.1.3 Pseudo tree of head 2,4,5 and 7 for graph H . . . . . . . . . . . . . . . . . . 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 2
  • 3. 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 isomorphism f between the graphs G and H is a bijection between the vertices of G and those of H, such as a pair of vertices u, v of G is an edge of G if and only if (u), (v) is an edge of H. 2 Building a pseudo tree Let’s say G a simple graph and s a vertex. The pseudo tree header s is done in the following way : 1. The vertex s in level 0. 2. The adjacents of s in level 1. 3. The adjacencies of each vertex of level 1 without repetition, which are not already in the other levels, in the level 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 of G a label is formed of four elements : 1. n the level it is at. 2. h the number of adjacent ones who are in the upper level. 3. m the number of adjacents who are in the same level. 4. b the number of adjacent ones who are in the lower level. 4 Algorithme Let’s say G a graph {g1, g2, g3, , , gn} and H a graph {h1, h2, h3, , , hn} The two graphs G and H are isomorphic if for the isomorphism function f(gi) = hi, we have the label of gi equals the label of hi. label(gi) = label(hi) = n − h − m − b 4.1 For the graph G Construct one or more pseudo-trees folds so as to have a label for each vertex of the graph G. 4.2 For the graph H Build pseudo trees and calculate labels for each vertex of H. Search in the graph G vertices that have the same label. If at least one vertex of H has an unequal label of the labels of the vertices of H, the header is modified and the labels of the vertices of H. If each vertex of H has a label equal to graph labels G, we do a validation or verification of the solutions. If the solution is not validated, the headers are changed. End if a solution is validated or check. 3
  • 4. 5 Mathematical proof 5.1 principal theorem Let’s say P(a) and Q(a ) two pseudo isomorphic trees. If f(a) = a we have: For each vertex s of 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 level n. 2. for h, there are h vertices of level n-1 adjacent to s such as d(s, th) = d(s , th) and d(a, th) = d(a , th) = n − 1, according to the definition there is also h vertices in Q(a’) 3. for m, there are m vertices of level n adjacent to s so d(s, tm) = d(s , tm) and d(a, tm) = d(a, tm) = n, according to the definition there are also m vertices in Q(a’). 4. for b, there are b vertices of level n+1 adjacent to s so d(s, tb) = d(s , tb) and d(a, tb) = d(a , tb) = n + 1, according to the definition there is also b vertices in Q(a’) . which shows that label(s) = label(s) 5.2 The algorithm According to principal theorem we have two cases: Case 1 label(s) = label(s ) =⇒ f(s) = s . Case 2 label(s) = label(s ), it is necessary to check f(s)=s’ (We can’t say that f(s) = s ) 5.2.1 The verification So after finding for each vertex of G one or more images of isomorphism f, we must do one last step: solution verification, this verification and polynomial. 5.2.2 The complexity All the steps of the algorithm are polynomial, so the algorithm proposed in this paper and Poly- nomial, so the isomorphism is in P. 6 Algorithm complexity Each vertex must be in a pseudo-tree, so the complexity is O(n2 ). For the second graph the complexity can reach O(n3 ). The calculation of the labels of each vertex is O(n). The solution validation is to O(n3 ). So this algorithm is polynomial. 4
  • 5. 7 Examples 7.1 connected graphs Either the two graphs G and H, present by lists of the following adjacents: Graph G Graph H 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 Graph G 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 graph G, we move on to graph H : Label (a)=0-0-0-0-4 so for graph H, 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 so f(a) = 5. 7.1.4 The labels head 2 vertex adjacent level top same bottom label images 2 6,7,8,9 0 empty 2 6,7,8,9 0-0-0-4 a 6 1,2,3,4,8 1 2 6,7,8,9 3,1,4,5 1-1-1-2 d,h 7 1,2,5,9 1 2 6,7,8,9 3,1,4,5 1-1-1-2 d,h 8 1,2,6 1 2 6,7,8,9 3,1,4,5 1-1-1-1 empty At the vertex 8, the label (1-1-1-1-1) does not exist in graph labels G, so f(a) = 2. head 4 vertex adjacent level top same bottom label images 4 1,5,6,9 0 empty 4 1,5,6,9 0-0-0-4 a 1 4,6,7,8,9 1 4 1,5,6,9 3,8,2,7 1-1-2-2 empty For vertex 1 the label (1-1-2-2) does not exist in the graph labels G, so f(a) = 4. 5
  • 6. 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 have f(2) = h and not d. and f(5) = d and 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 graphs G and H 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 6
  • 7. 8 pseudo codes 8.1 pseudo-arbres Here is a pseudo code that generates a pseudo tree. Algorithm 1: generate a pseudo tree P(a) head a for a graph G Data: A graph G and a vertex a of G Result: A pseudo tree P(a) 1 initialization; the vertex a in the level 0; 2 the adjacent from a in level 1; 3 the vertices of G in array graph[]; 4 delete the vertices of the level 0 and 1 array graph[]; 5 niv ← 1 ; 6 adjacents ← adjacent to a ; 7 while graph[] is not empty do 8 initialize array list[] empty ; 9 niv ← niv + 1 ; 10 for every element of 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[] and list[] ; 16 if graph[] is empty then 17 break; 18 end 19 end 20 if lise[] is empty then 21 break; 22 else 23 list in level niv ; 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 s in a pseudo tree Data: A vertex s in a pseudo tree Result: s label 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 level n; 4 nivb ← determine the vertices that are in the level n-1; 5 h ← the number of adjacent vertices s that are in nivh; 6 m ← the number of adjacent vertices s that are in nivm; 7 b ← the number of adjacent vertices s that are in nivb; 8 label(s) ← "n-h-m-b"; 7
  • 8. 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 for Each f(a)=a’ proposed do 4 adjacent(a) ← the adjacent vertices a; 5 adjacent(a ) ← the adjacent vertices a’; 6 for each adjacent to a do 7 x ← an adjacent vertex adjacent a; 8 x ← the images of x by isomorphism; 9 Intersection ← the intersection between the images of x by 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 err = 0 then 16 break; 17 end 18 end 19 if err = 0 then 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. 8