SLIDE 1 Introduction to Algebraic Graph Transformation
Fernando Orejas
Royal Holloway University of London
- n leave from Universitat Politècnica de Catalunya, Barcelona
SLIDE 2
- Lecture 1: Basic Notions in Graph Transformation
- Lecture 2: Fundamental Theory of GT
- Lecture 3: Conditional Graph Transformation
- Lecture 4: Model Transformation by Triple Graph
Grammars
SLIDE 3
- 1. Introduction
- 2. The basic case
- 3. Generalizing Graph Transformation
- 4. Variations
- 5. Extensions
SLIDE 4
Introduction
SLIDE 5
Origins of Graph Transformation (1969): Generalization of Chomsky Grammars
SLIDE 6
Chomsky Grammars: A AA B AA B B A B
SLIDE 7
Term Rewriting: f(x) Chomsky Grammars: A AA B AA B B A B f(f(x)) h( f(f(a) ) h( f(a) )
SLIDE 8
Term Rewriting: f(x) A A A A B B B B A A
?
Chomsky Grammars: A AA B AA B B A B Graph Grammars f(f(x)) h( f(f(a) ) h( f(a) )
SLIDE 9
– What kind of graphs? – What kind of transformations – How do we describe transformations
SLIDE 10
– What kind of graphs? Any kind (and more) – What kind of transformations Replacing subgraphs by subgraphs – How do we describe transformations Algebraic double pushout approach
SLIDE 11
The basic case
SLIDE 12 A graph G1 consists of:
- V: nodes
- E: edges
- source: E → V
- target: E → V
SLIDE 13 A graph morphism h: G1 → G2 consists:
such that
- 1. hV(source1(e1)) = source2(hE (e1))
- 2. hV(target1(e1)) = target2(hE (e1))
SLIDE 14
– What is a graph transformation rule? – How do we apply a rule?
SLIDE 15
Double Pushout Graph Transformation Rules
K L R l r
p = Rules
SLIDE 16
A graph transformation rule:
SLIDE 17
Rule Application
m L K G l R r
SLIDE 18 Rule Application
- 1. D = G \ m(L\K) is a pushout complement
l’ m L D K G d l R r (1)
SLIDE 19 Rule Application
- 2. The result is H = D + (R\K)
l’ m L D K G d l r’ H R m’ r (1) (2)
(1) and (2) are pushouts
SLIDE 20
SLIDE 21
SLIDE 22
SLIDE 23
SLIDE 24
SLIDE 25
Gluing Conditions
SLIDE 26
Gluing Conditions
?
SLIDE 27
Gluing Conditions
SLIDE 28
?
Gluing Conditions
SLIDE 29
For every x1,x2 in VL∪ EL, if m(x1) = m(x2) then: x1 ∈ K iff x2 ∈ K.
For every e in EG\m(EL) if source(e) or target(e) have a pre- image in VL then they also have it in KL
SLIDE 30
Theorem: Given
m L K G l
There is a pushout complement if and only if the identification and the dangling edge conditions hold. Moreover, this pushout complement is unique.
SLIDE 31
Generalizing Graph Transformation
SLIDE 32 A category C is adhesive if:
- 1. C has pushouts over monomorphisms. Moreover
monomorphisms are closed by pullbacks and pushouts.
- 2. C has pullbacks
- 3. Pushouts over monomorphisms are Van Kampen
squares. Adhesive Categories (Lack and Sobocinski)
SLIDE 33
A pushout is a Van Kampen Square if for every commutative cube, where we have the pushout in the bottom square and the back squares are pullbacks, we have that the top square is a pushout if and only if the front squares are pullbacks: C' A' B' D' C A B D Adhesive Categories (Lack and Sobocinski)
SLIDE 34
- Complements of pushout along monos are unique
- Pushouts along monos are pullbacks
- If C1 and C2 are adhesive so is C1xC2
- If C is adhesive so are the slice, co-slice and functor
categories over C Properties of Adhesive Categories
SLIDE 35
C U B' A C B D Complements of pushout along monos are unique
A C D B po A C D B' po
C
SLIDE 36
- C has epi-mono pair factorization if for every pair
morphisms f1 and f2, there is an object K, jointly epimorphic morphisms e1 and e2, and a monomorphism m, such that the diagram above commutes Constructions over Adhesive Categories A1 A2 C e1 f1 m f2 K e2
SLIDE 37
- C has initial pushouts along monomorphisms if for every
morphism m, there is an initial pushout BCAA' along a monomorphism r: Constructions over Adhesive Categories
D1 B r1 H1 C c* r A b' m A' c’ b* b c
SLIDE 38
Initial Pushout
m b c r
SLIDE 39
m is boundary consistent with respect to a monomorphism m below if there exists an initial pushout and a morphism b' such that b = l·b': Gluing Conditions for Adhesive Categories
m L K G l m' B C b b'
SLIDE 40
Gluing Conditions for Adhesive Categories
m L K G l m' B C b b' D
The morphisms l and m below have a pushout complement iff m is boundary consistent with respect to l.
SLIDE 41
Given an element Z in C we can define an algebra of its subobjects: Algebra of Subobjects
B B∩C po Z C B B∪C C B∩C pb
The class of subobjects of Z is a distributive lattice
SLIDE 42
Variations
SLIDE 43
L R
p = Single pushout transformations Rules are partial monomorphisms (inclusions):
SLIDE 44
Rule Application Roughly, single pushout graph transformation removes from G the elements that are in m(L\dom(p)) and adds to G the elements in R\p(L) but, in case of conflict, removes the conflicting elements
p' m L H R G p po
SLIDE 45
Rule Application Given h, h': the co-equalizer (C,f) is constructed in the category of graphs with partial morphisms as follows: C is the largest subgraph of B and of (h(A) ∩h'(A)) ∪ (h(A) ∩ h'(A))
A B h h' C f
SLIDE 46 Rule Application
G L m D R p (po) Dom(p) H
- 1. Build D as the pushout of Dom(p) → G and Dom(p) → R
- 2. Build H as the co-equalizer of LRD and LGD
SLIDE 47
Examples
SLIDE 48
Given
K L R l r
p =
we can define
L R
p' =
with dom(p') = K and p'(x) = r(x).
SPO and DPO
SLIDE 49
Given
K L R l r
p =
we can define
L R
p' =
with dom(p') = K and p'(x) = r(x).
SPO and DPO
SLIDE 50
SPO and DPO If m: L → G satisfies the gluing conditions then DPO and SPO transformations coincide.
SLIDE 51
SLIDE 52
Sesqui-pushout transformations Rules are spans, like for DPO transformations:
K L R l r
p =
SLIDE 53
Rule Application
l’ m L D K G d l r’ H R m’ r fpb po
SLIDE 54
Final Pullbacks
L D K G K' fpb h' h
KLDG is a final pullback if for every other pullback K'LD'G and every morphism h there is a unique h such that the diagram commutes
D'
SLIDE 55 Properties of Final Pullbacks
- 1. Final pullback complements are unique when they exist,
even if the morphisms in the pullback are not monos.
- 2. Final pullbacks along monos are pushouts.
- 3. Final pullback complements exist if and only if the
identification condition holds.
- 4. When the morphism K → L is not a mono, the rules
clone the identified elements.
SLIDE 56
Extensions
SLIDE 57
Typed Graphs
SLIDE 58 A typed graph consists of:
SLIDE 60
- 3. A morphism TG: G → GT, assigning its type to each
element in G
SLIDE 61
SLIDE 62
SLIDE 63
Morphisms G1 GT G2 TG1 TG2 h
SLIDE 64
Typed graphs over a given type graph GT are an adhesive category. A typed graph transformation rule:
K L R l r
p =
GT
Typed Graphs Transformation
SLIDE 65
Rule Application
m L D K G l H R r GT GT
SLIDE 66
count=n count=n+1
Attributed graphs
SLIDE 67
E-graphs
count n
SLIDE 68
count n with n ≥ 0
Attributed (Symbolic) graphs
SLIDE 69
- Symbolic graphs are pairs (G,Φ), where G is an E-
graph over a set of variables X and Φ is a set of formulas over X and the operations, predicates and data of the given data algebra D.
- A symbolic graph morphism h: (G,Φ) → (G',Φ') is an E-
graph morphism h: G → G' such that D |= Φ' ⇒ h(Φ) Attributed (Symbolic) graphs
SLIDE 70
- The category of symbolic graphs is not adhesive, but it
is M-adhesive, where an M-morphism (G,Φ) → (G',Φ') is a monomorphism such that D |= Φ' ≡ h(Φ) Attributed (Symbolic) graphs
SLIDE 71
Attributed (Symbolic) graphs
count n count n count n' with n' = n+1
SLIDE 72
count=0
SLIDE 73
count=1
SLIDE 74
¡Thank You!