Graph Theory ITEC 320 Lecture 21. Graph Theory Review Higher level usage of pointers –Factories...

Preview:

Citation preview

Graph Theory

ITEC 320Lecture 21

Graph Theory

Review

• Higher level usage of pointers– Factories– Flyweight– Disk pool

• Rationale• Benefits / Downsides

Graph Theory

Outline

• Rationale • Definition• Methods of implementation• Algorithms

Graph Theory

Cell phones

• How do they work (communication side)

Graph Theory

Cell Networks

Graph Theory

Other scenarios

• Computer networks• Google maps• Facebook friends• Gaming

Graph Theory

Rationale

• How do you model a cell phone network on a computer?

• Why would you want to simulate a cell phone network?

Graph Theory

Graphs

• Composed of vertices and edges• Vertices– Represent an object in a graph

• Edges– A connection between two vertices

Graph Theory

Variations

• Weighted graph– Toll road– Hotel cost– Identifiers

• Possible usage scenarios?

Graph Theory

Methods of implementation

• Arrays• Pointers• Benefits of each approach• Downsides of each approach

Graph Theory

Code

• Should we use a package?• What about generics?

Graph Theory

Searching

• How do you find information in a graph?

Destination

Start

Graph Theory

Breadth first

• For each node I am connected to– Is this the node I’m looking for?

• If I didn’t find it– For each node I am connected to• Call breadth first search on it

Graph Theory

Depth first

• If I am the node searched for, stop and return

• For each node I am connected to– Call depth first search on that node

Graph Theory

Issues

• What are some of the issues that might happen with searching?

• How do you implement each way?– Stacks / Recursion / Packages / ?

Graph Theory

More

• How do you pick the best path?– Lowest cost– Highest cost– Cover all points with least overlap

Graph Theory

Summary

• Rationale for graph theory• Approach• Finding algorithms

Recommended