• Keine Ergebnisse gefunden

1.2 Contributions

2.1.2 Labeled Graphs

Labels for graphs may be introduced for a plethora of purposes. One of the most important ones is readability since abstract nodes, such as the ones we used above (v, v0, w, v1, v2, . . .), do not necessarily translate well to real-world objects to be modeled. For instance, a road network is recognized to model a geographical area only if the points of interest resemble the ones in the area, at least by their names, but also by the way they are interconnected.

Another purpose is to overcome the limitations inherited from set theory partially, that is, the impossibility to include the same object twice, i. e., having two distinct nodes or edges modeling the same real-world object or relationship.

No matter what kind of labeling we pursue, a labeling alphabet is required. Let Σbe such an alphabet. Although not limited in what it may contain, Σis usually assumed to be nite. The least invasive form of labeling a directed graphG= (V, E) is to introduce a node labeling function l : V → Σ, that assigns a label from Σ to every node in the graph, maintainingG's mathematical structure as introduced in Equation (2.1). Since the alphabet represents an integral part of labeled graphs, it is usually a component of the signature of graphs. A directed node-labeled graph is, thus, a quadruple G = (V,Σ, E, l) where(V, E) is a directed graph and l : V → Σ a node labeling function over the nite alphabetΣ.

Many of the basic notions introduced in Section 2.1.1 directly apply to node-labeled graphs. The decision whether two nolabeled graphs are considered equal, usually de-pends on the application but is often based on a notion of graph isomorphism. Besides relating two such graphs,G= (VG,Σ, EG, lG) and H = (VH,Σ, EH, lH), on a mere struc-tural basis, i. e., by isomorphisms between(VG, EG)and(VH, EH), we may also foster more elaborate notions of equality by integrating the labeling functions. The quasi-standard is to require label equality of isomorphic nodes. However, more general notions are conceptually available, for instance, alignments overΣ [110]. A binary relation over Σ, ' ⊆Σ×Σ, is called an alignment, which is a purpose-driven notion saying that some symbola∈Σmay be the same as another symbolb∈Σ, expressed by(a, b)∈ '. We writea'bfor(a, b)∈ '.

As a relation, an alignment may be of any form, e. g., an (injective/bijective) function or an equivalence relation. Examples for 'are identity, i. e.,'=idΣ :={(a, a)|a∈Σ}, or, less formally, synonymity, i. e., all symbols that may replace one another in any context, based on some linguistic model. Label equality, as sketched above, is the special case of choosing'=idΣ. Incorporating a given alignment', we obtain a generalization of graph isomorphisms ιbetween node-labeled graphsG andH by

1. ιis a graph isomorphism between(VG, EG) and(VH, EH) and 2. ιis '-preserving, i. e., for allv∈VG,lG(v)'lH(ι(v)).

This alignment version of graph isomorphisms does indeed make the notion of graph iso-morphisms more liberal as one node label may be aligned with several others. On the other hand, alignments have the power to be more restrictive since nodes, although structurally isomorphic, disqualify to be related as their labels cannot be aligned under '.

Example 2.5 Suppose we have a labeling alphabetΣ ={a, b, c}and an alignment'with a'c and b'c. Then we can nd graph isomorphisms betweenG and H, respecting ', only ifGuses the labelsaor b, whileH may only use labelc. As soon asGalso uses label c or H uses one of the labels aor b, no isomorphism exists, that preserves'.

Note that we assumedGandH to be labeled over the same alphabetΣ. This assumption may appear as limiting at rst but actually is none. Assume, Gis labeled overΣG andH over ΣH. Then indeed, both graphs are labeled over ΣG∪ΣH without contradicting any of the previous denitions. Hence, graph alphabets can always be made the same without causing harm in the course of comparing two graphs that use them. Having both graphs labeled over the same alphabet does not necessarily mean that they are using all available labels. The alphabet is an upper bound for which we have to check label equality (or alignment).

In principle, the same procedure as for node labels may be followed when assigning labels to edges employing an edge labeling function l :E → Σ. Thereby, we achieve that two distinct edges may represent dierent relationships, e. g., one may express friendship, and the other might mean customer relationship. Both of these types can be expressed in a single edge-labeled graph model. However, a concrete relationship (v, w) can only be assigned a single relationship type (also called predicate), although more than one relationship type associated with v and w could be desired. Therefore, the edge labeling is usually integrated into the edge structure of a directed graph, in that an edge e is considered to be a triple (v, a, w) of a source node v (=source(e)), a labela(=label(e)), and a target nodew(=target(e)). The labeling function is left implicit, but the number of dierent relationship types between any two nodes is increased to the number of dierent labels in Σ. Since edge-labeled graphs are the core data structure we use throughout the rest of the thesis, we call them simply labeled graphs.

Denition 2.6 (Labeled Graph)

A labeled graph G is a triple(V,Σ, E), where V is a nite set of nodes, Σa nite (label)

alphabet, and E⊆V ×Σ×V. N

All the notations introduced for directed graphs in Section 2.1.1 carry over to labeled graphs, naturally. Additionally, the labeling of edges allows for more ne-grained consid-erations w. r. t. neighborhood. LetG= (V,Σ, E)be a labeled graph ande= (v, a, w)∈E. As an inx notation we use v Ea w, where the edge relation E is superscripted with the label a ∈ Σ, formally justied by Ea := {(v, w) | (v, a, w) ∈ E}. w is not only some successor ofv (v a predecessor ofw, resp.), but, more specically,wis ana-successor ofv (vis ana-predecessor ofw, resp.) inG. Utilizing this notation, the sets of alla-successors and a-predecessors (a∈Σ) of v∈V are naturally expressed byvEa and Eav.

r a s

u

b c

(a)

w c x

y

a b

(b)

r a q b

(c)

z {a, b}

(d) Figure 2.4: Sample Graphs for Labeled Morphisms

Assessing equality of labeled graphs G = (VG,Σ, EG) and H = (VH,Σ, EH) is again based on graph isomorphisms. Additional incorporation of alignments is imaginable. How-ever, the most prominent cases discussed and used in the literature are bijective alignments.

Hence, the alignment itself does not play any rôle in the course of deciding label equality.

The edge labels can easily be adapted so thatGand H use precisely the same labels.

Example 2.7 We align the labeled graphs G and H, where G is labeled over ΣG and H over ΣH. Let ' be a bijective function from ΣG to ΣH, i. e., for any pair of labels a, b∈ΣG, ifa'c and b'c, then a=b, and for all c∈ΣH ana∈ΣG exists with a'c. DeneH/' to have the same set of nodes as H, but for every edge (v, c, w) of H include the edge(v, a, w) instead, wherea'c. As a consequence, H/' is labeled over ΣG.

Thus, if not stated otherwise, we assume all graphs to be labeled over the same xed alphabet Σ. Since the notions of graph homomorphisms and isomorphisms are needed often throughout the thesis, we dene their labeled versions formally.

Denition 2.8 (Graph Morphisms)

LetG= (VG,Σ, EG) and H = (VH,Σ, EH) be labeled graphs. A functionη :VG→VH is called a graph homomorphism betweenG andH iv EGa w impliesη(v)EHa η(w)(a∈Σ).

An injective graph homomorphism is called a subgraph isomorphism.

A graph isomorphism between G and H is a bijective function ι:VG →VH, such that

v EGa wi ι(v)EaH ι(w). N

Example 2.9 Let us rst reconsider the unlabeled graphs of Example 2.4. They are essentially labeled graphs using a single letter from the alphabet, sayτ ∈Σ, as each edge's label. Thus, all the homomorphisms exemplied there are valid homomorphisms for the labeled versions.

In contrast, if graph G(a) and G(b) involve a dierent labeling function, they may not be associated by any homomorphism, as shown by the graphs depicted in Figure 2.4 (a) and (b). The only candidate homomorphism is η(a)7→(b) (r 7→ y, s7→ x, u 7→ w) from Example 2.4 since it is only this morphism that respects the graph structure (independently of the labeling). But whileuis theb-successor ofrinG(a), theb-successor ofη(a)7→(b)(r) =y isxandx6=w=η(a)7→(b)(u). In fact, there is no graph homomorphism between the labeled graphsG(a) andG(b).

Regarding the graphsG(c)andG(d)in Figure 2.4 (c) and (d), there is a homomorphism between them, namelyη(c)7→(d)(r 7→z, q7→z). The semantics of the label{a, b}associated with the edge fromz to zinG(d) is that there is ana-labeled and ab-labeled edge.

LetG = (V,Σ, E) be a labeled graph, Γ ⊆Σ, and v, w ∈V. If there is an edge v Ea w for every a ∈ Γ, we usually summarize all these edges to a single edge labeled by Γ in drawings ofG.