Docsity

Graph Theory: Lecture Announcements and Concepts, Lecture notes of Object Oriented Programming

Partial preview of the text

Download Graph Theory: Lecture Announcements and Concepts and more Lecture notes Object Oriented Programming in PDF only on Docsity!

Graphs

Announcements

• Prelim

2:^ Two

and^ a^

half^ weeks

from^ now

  • Tuesday,

April16,^ 7:

‐9pm,^ Statler

• Exam

conflicts? – We need^ to^ hear

about^ them

and^ can^ arrange

a^ makeup

-^ It^ would

be^ the^ same

day^ but^ 5:

‐7:

• Old^ exams

available

on^ the

course

website

These

are^ Graphs

K^5

K^ 3,3 =

Applications

of^ Graphs

Communication

networks

Routing

and^ shortest

path^ problems

Commodity

distribution

(flow)

Traffic

control

Resource

allocation

Geometric

modeling

Example

Directed

Graph

(Digraph)

V = {^ a,b,c,d,e,f

E = {^ (a,b), (a,c), (a,e), (b,c), (b,d), (b,e), (c,d),(c,f), (d,e), (d,f), (e,f)

|V| = 6, |E| = 11

b c^ a

d f e

Example

Undirected

Graph

An^ undirected graph

is just like a directed graph, except the edges are

unordered pairs

( sets ) {u,v}

Example:

b c a

d f e

V = {^ a,b,c,d,e,f

E = {^ {a,b}, {a,c}, {a,e}, {b,c}, {b,d}, {b,e}, {c,d}, {c,f},{d,e}, {d,f

}, {e,f^ }^ }

More

Graph

Terminology

A^ path

is^ a^ sequence

v0,v,v^1

,...,vpof 2

vertices

such^ that

(v^ ,v)ii+^

E,^0

≤^ i^ ≤^ p^ –

The^ length

of^ a^ path

is^ its^ number

of^ edges

In^ this

example,

the^ length

is^5

A^ path

is^ simple

if^ it^ does

not^ repeat

any

vertices A^ cycle

is^ a^ path

v,v,v^0

,...,vpsuch 2

that^ v

=^ vp

A^ cycle

is^ simple

if^ it^ does

not^ repeat

any

vertices

except

the^ first

and^ last

A^ graph

is^ acyclic

if^ it^ has

no^ cycles

A^ directed

acyclic

graph^

is^ called

a^ dag

v^0

v^5 b a

dc e f docsity.com

Is^ This

a^ Dag?

•^ Intuition:^ –^ If^ it’s

a^ dag,^ there

must^ be

a^ vertex

with^ indegree

zero

–^ why? • This^ idea

leads

to^ an

algorithm

-^ A^ digraph

is^ a^ dag^

if^ and^ only

if^ we^ can

iteratively

delete^ indegree

‐^0 vertices

until^ the

graph^ disappears b c^ a

d f e

Is^ This

a^ Dag? b dc^ e

f

^ Intuition:^ ^ If^ it’s

a^ dag,^ there

must^ be

a^ vertex

with^ indegree

zero

–^ why?  This^ idea

leads

to^ an

algorithm

^ A^ digraph

is^ a^ dag^

if^ and^ only

if^ we^ can

iteratively

delete^ indegree

‐^0 vertices

until^ the

graph^ disappears

Is^ This

a^ Dag? b dc^ e

f

^ Intuition:^ ^ If^ it’s

a^ dag,^ there

must^ be

a^ vertex

with^ indegree

zero

–^ why?  This^ idea

leads

to^ an

algorithm

^ A^ digraph

is^ a^ dag^

if^ and^ only

if^ we^ can

iteratively

delete^ indegree

‐^0 vertices

until^ the

graph^ disappears

Is^ This

a^ Dag?d^ c^ e

f

^ Intuition:^ ^ If^ it’s

a^ dag,^ there

must^ be

a^ vertex

with^ indegree

zero

–^ why?  This^ idea

leads

to^ an

algorithm

^ A^ digraph

is^ a^ dag^

if^ and^ only

if^ we^ can

iteratively

delete^ indegree

‐^0 vertices

until^ the

graph^ disappears

Is^ This

a^ Dag?^ d e

f

^ Intuition:^ ^ If^ it’s

a^ dag,^ there

must^ be

a^ vertex

with^ indegree

zero

–^ why?  This^ idea

leads

to^ an

algorithm

^ A^ digraph

is^ a^ dag^

if^ and^ only

if^ we^ can

iteratively

delete^ indegree

‐^0 vertices

until^ the

graph^ disappears

Is^ This

a^ Dag?^ e

f

^ Intuition:^ ^ If^ it’s

a^ dag,^ there

must^ be

a^ vertex

with^ indegree

zero

–^ why?  This^ idea

leads

to^ an

algorithm

^ A^ digraph

is^ a^ dag^

if^ and^ only

if^ we^ can

iteratively

delete^ indegree

‐^0 vertices

until^ the

graph^ disappears

Is^ This

a^ Dag?^ e

f

^ Intuition:^ ^ If^ it’s

a^ dag,^ there

must^ be

a^ vertex

with^ indegree

zero

–^ why?  This^ idea

leads

to^ an

algorithm

^ A^ digraph

is^ a^ dag^

if^ and^ only

if^ we^ can

iteratively

delete^ indegree

‐^0 vertices

until^ the

graph^ disappears