• Keine Ergebnisse gefunden

Graphs and classic graph problems

N/A
N/A
Protected

Academic year: 2022

Aktie "Graphs and classic graph problems"

Copied!
11
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

21.05.12 | Komplexität| 48

Graphs and classic graph problems

§  What is a graph?

§  An undirected graph is a pair G=(V,E), with E ⊆{{u,v} | u,v∈ V}.

§  The elememts of E are not ordered.

§  Elements of V are called nodes, or vertices resp.

Elements of E are called edges

§  A directed graph is a pair G=(V,E) as well. However, the elements of E are ordered pairs of elements of V. Thus

E ⊆{(u,v) | u,v∈ V}.

§  Elements of V are called nodes

Elements of E are called directed edges (in ger.: gerichtete Kanten or Bögen)

(2)

21.05.12 | Komplexität| 49

Graphs and classic graph problems

Neighborhood relations

Incidence: A node v is said to be incident to an edge e if : v∈e.

adjacency: Two nodes are called adjacent in G, if {x,y}∈E.

Degree: The degree of a node v [ deg(v) ] is the number of with v incident edges.

Clique: If any two nodes of G a neighbors, G is called the complete graph.

G is also called a clique.

y x

v e

(3)

21.05.12 | Komplexität| 50

Graphs and classic graph problems

Claim: ∑"∈#↑▒​deg⁠(") =2|*| 

Proof: counting edges

Claim: {v | deg(v) odd} is even Proof:clear

(4)

§  Paths and Cycles

– A path in a graph (directed or non-directed) G = (V,E) is a sequence of nodes (v0,v1,...,vk) from V, such that for all i ∈{1,...,k} is valid that (vi−1,vi) ∈ E (or {vi

−1,vi} ∈ E, resp.) is an edge.

If i<j, vi is called a predecessor of vj, and vj a successor of vi

– A path is called simple, if no node occurs more than once in the sequence (v1,...,vk).

– A simple path is called cycle, if v0 =vk.

– A graph is called acyclic (ger.: kreisfrei), if there is no cycle contained in the graph.

21.05.12 | Komplexität | 51

Graphs and classic graph problems

(5)

§  Connected components

– A undirected graph G is connected, if there is a path from v to w for all node pairs v,w∈V.

–  A directed graph is strongly connected, if there are paths from all nodes to any other node.

– Connected parts of G are called connected components.

Reminder:

A set V with binary relation is called an equivalence relation if for all for all x,y,z ∈V:

i) x ~x, reflexive ii) x~y => y~ x , symmetric iii) x~y and y~z => x~z, transitive

Observations: Connected components of a graph form equivalence classes.

G is connected if it has only one equivalence class.

21.05.12 | Komplexität | 52

Graphs and classic graph problems

(6)

21.05.12 | Komplexität| 53

Graphs and classic graph problems

Seven bridges of Königsberg (Euler 1736):

Is it possible was to find a walk through the city that would cross each bridge once and only once? Such a walk is called Eulerian path.

An Eulerian path with identical start and end point is called Eulerian cycle.

à no, both do not exist in Königsberg of 1736.

land mass 1

lm 2

lm 3

lm 4

(7)

21.05.12 | Komplexität| 54

Graphs and classic graph problems

Seven bridges of Königsberg (Euler 1736):

Claim: A necessary and sufficient condition for a walk of the desired form is that the graph is connected and has exactly zero (-> Eulerian cycle) or two nodes (-> Eulerian path) of odd degree.

Haus vom Nikolaus contains -  1 node of degree 2

-  2 nodes of degree 4 -  2 nodes of degree 3

à Contains an Eulerian path, but no Eulerian cycle.

(8)

21.05.12 | Komplexität| 55

Graphs and classic graph problems

Bipartite graphs

A graph is called bipartit, if it is possible to partition V into two disjoint parts V1 and V2 , such that each edge has one end in V1 and the other one in V2.

Claim: A graph is bipartite if and only if any cycle in the graph has even length.

Proof: Exercise

(9)

– A tree is a connected graph without any cycles

– A forest is a graph without any cyles, thus a collection of trees.

–  Nodes with degree 1 are called leaf, the others inner nodes.

Claim: A forest F has |E| = |V| – C(F) edges, with C number of components.

Claim: If |E| > |V| – C(F), G will contain a cycle.

Claim: For any tree is valid: |E| = |V| – 1 Proof: Exercise

21.05.12 | Komplexität | 56

Graphs and classic graph problems

tree tree

together: a forest

(10)

§  subgraphs, spanning subgraphs

– G‘=(V‘,E‘) is called subgraph of G=(V,E), if V‘⊆V and E‘⊆E.

– G‘ ⊆ G is called a spanning subgraph of G, when additionally: V‘=V

Claim: A graph is connected iff it contains a spanning tree.

(Proof: <=: clear; =>: remove edges from cycles)

21.05.12 | Komplexität | 57

Graphs and classic graph problems

Graph with subgraph spanning tree

(11)

§  Complementary Graph

– The for G complementary graph G‘ is the graph G‘=(V,E‘), with (i,j)∈E‘ ⇔ (i,j)∉E

– Claim: At least one of the graphs G or G‘ is connected.

Proof: Exercise.

21.05.12 | Komplexität | 58

Graphs and classic graph problems

graph complement

Referenzen

ÄHNLICHE DOKUMENTE

A walk in a connected graph G = ( V, E ) is called an Eulerian trail if it contains each edge of G exactly once?. A closed Eulerian trail is called an

When we store the number of nodes for a graph G=(V,E) plus the degree and the neighbours of each node , such a data structure will be called an adjecency- list

A graph is called eulerian if it contains an Eulerian cycle?. (a) Which of the given graphs in Figure 1 are

each edge contains one vertex

This introduces exchangeable random graphs and gives a one-to-one correspondence between infinite ex- changeable random graphs and distributions on the space of proper graph

In this situation rebellion against the Turkish government is not only allowed, but obligatory for all Moslems, in order to replace it by a just government that acts. upon

The main results in this dissertation regard the phase transitions in three different random graph models: the minimum degree graph process, random graphs with a given degree

Differences between those who argue that it’s a disease and those who argue that it’s just a risk factor for conditions such as type 2 diabetes and heart disease are unlikely to