15.08.2013 Views

General Computer Science 320201 GenCS I & II Lecture ... - Kwarc

General Computer Science 320201 GenCS I & II Lecture ... - Kwarc

General Computer Science 320201 GenCS I & II Lecture ... - Kwarc

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

that represent the nodes for convenience, the only thing that matters for graphs is which nodes<br />

are connected to which. Indeed that is just what the definition of graph equivalence via the<br />

existence of an isomorphism says: two graphs are equivalent, iff they have the same number of<br />

nodes and the same edge connection pattern. The objects that are used to represent them are<br />

purely coincidental, they can be changed by an isomorphism at will. Furthermore, as we have<br />

seen in the example, the shape of the diagram is purely an artifact of the presentation; It does not<br />

matter at all.<br />

So the following two diagrams stand for the same graph, (it is just much more difficult to state<br />

the graph isomorphism)<br />

Note that directed and undirected graphs are totally different mathematical objects. It is easy<br />

to think that an undirected edge {a, b} is the same as a pair 〈a, b〉, 〈b, a〉 of directed edges in<br />

both directions, but a priory these two have nothing to do with each other. They are certainly<br />

not equivalent via the graph equivalent defined above; we only have graph equivalence between<br />

directed graphs and also between undirected graphs, but not between graphs of differing classes.<br />

Now that we understand graphs, we can add more structure. We do this by defining a labeling<br />

function from nodes and edges.<br />

Labeled Graphs<br />

Definition 370 A labeled graph G is a triple 〈V, E, f〉 where 〈V, E〉 is a graph and<br />

f : V ∪ E → R is a partial function into a set R of labels.<br />

Notation 371 write labels next to their vertex or edge. If the actual name of a vertex does<br />

not matter, its label can be written into it.<br />

Example 372 G = 〈V, E, f〉 with V = {A, B, C, D, E}, where<br />

E = {〈A, A〉, 〈A, B〉, 〈B, C〉, 〈C, B〉, 〈B, D〉, 〈E, D〉}<br />

f : V ∪ E → {+, −, ∅} × {1, . . . , 9} with<br />

f(A) = 5, f(B) = 3, f(C) = 7, f(D) = 4, f(E) = 8,<br />

f(〈A, A〉) = −0, f(〈A, B〉) = −2, f(〈B, C〉) = +4,<br />

f(〈C, B〉) = −4, f(〈B, D〉) = +1, f(〈E, D〉) = −4<br />

-0<br />

-2 +1 -4<br />

5 3 4 8<br />

-4<br />

7<br />

+4<br />

c○: Michael Kohlhase 219<br />

Note that in this diagram, the markings in the nodes do denote something: this time the labels<br />

given by the labeling function f, not the objects used to construct the graph. This is somewhat<br />

confusing, but traditional.<br />

Now we come to a very important concept for graphs. A path is intuitively a sequence of nodes<br />

that can be traversed by following directed edges in the right direction or undirected edges.<br />

119

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!