SlideShare a Scribd company logo
Boris, Ben, Bob, Bess, Beth and Bill are waiting in a
doctor’s surgery. Looking around the room, each of them
sees that they know some of the other people in the room.
Ben knows five of the other people sitting in the room,
Bob knows four of the others,
Beth and Bill both know three of the others,
Bess knows two of the others and
Boris only knows one of the other people.

Who knows who in the waiting room?
Adjacency Matrices
• Directed and Undirected Graphs
• Weighted graphs
Adjacency Matrix or List
• Matrix is fast and direct
• Quick for adding and deleting edges
• Not so good for adding and deleting
  vertices
• Can be very ‘sparse’ and therefore
  inefficient
Paths and Path problems
• From one vertex to another along edges

• Explorer’s problem
• Path that travels each edge once and returns
  to starting point

• Traveller’s problem
• Path that visits each vertex only once before
  returning to starting point.
Closed paths and cycles
• Closed Path or circuit:
  Path that ends at the starting vertex
• Cycle
  circuit for which each intermediate
  vertex is different
• Tree
  Undirected connected graph with no
  cycles
Closed paths and cycles
• Closed Path or circuit:
  Path that ends at the starting vertex
• Cycle
  circuit for which each intermediate
  vertex is different
• Tree
  Undirected connected graph with no
  cycles

More Related Content

More from grahamwell

Introduction to touch develop
Introduction to touch developIntroduction to touch develop
Introduction to touch develop
grahamwell
 
The software story
The software storyThe software story
The software story
grahamwell
 
Turtle graphics
Turtle graphicsTurtle graphics
Turtle graphics
grahamwell
 
Database field types
Database field typesDatabase field types
Database field types
grahamwell
 
Databases 101
Databases 101Databases 101
Databases 101
grahamwell
 
Kodu controls
Kodu controlsKodu controls
Kodu controls
grahamwell
 
Pascal names and types
Pascal names and typesPascal names and types
Pascal names and types
grahamwell
 
Python part two names and types
Python part two names and typesPython part two names and types
Python part two names and types
grahamwell
 
Abstraction - Year 9
Abstraction - Year 9Abstraction - Year 9
Abstraction - Year 9
grahamwell
 
Thinking about your project
Thinking about your projectThinking about your project
Thinking about your project
grahamwell
 
The rail fence
The rail fenceThe rail fence
The rail fence
grahamwell
 
Lesson 1
Lesson 1Lesson 1
Lesson 1
grahamwell
 
Rsa encryption
Rsa encryptionRsa encryption
Rsa encryption
grahamwell
 
Server side scripts
Server side scriptsServer side scripts
Server side scripts
grahamwell
 
Revision topic 1 sensors and control
Revision topic 1 sensors and controlRevision topic 1 sensors and control
Revision topic 1 sensors and control
grahamwell
 
Mtslesson
MtslessonMtslesson
Mtslesson
grahamwell
 
Hashing
HashingHashing
Hashing
grahamwell
 
Hashing
HashingHashing
Hashing
grahamwell
 
Gm names n stuff
Gm   names n stuffGm   names n stuff
Gm names n stuff
grahamwell
 
Reverse polish notation
Reverse polish notationReverse polish notation
Reverse polish notation
grahamwell
 

More from grahamwell (20)

Introduction to touch develop
Introduction to touch developIntroduction to touch develop
Introduction to touch develop
 
The software story
The software storyThe software story
The software story
 
Turtle graphics
Turtle graphicsTurtle graphics
Turtle graphics
 
Database field types
Database field typesDatabase field types
Database field types
 
Databases 101
Databases 101Databases 101
Databases 101
 
Kodu controls
Kodu controlsKodu controls
Kodu controls
 
Pascal names and types
Pascal names and typesPascal names and types
Pascal names and types
 
Python part two names and types
Python part two names and typesPython part two names and types
Python part two names and types
 
Abstraction - Year 9
Abstraction - Year 9Abstraction - Year 9
Abstraction - Year 9
 
Thinking about your project
Thinking about your projectThinking about your project
Thinking about your project
 
The rail fence
The rail fenceThe rail fence
The rail fence
 
Lesson 1
Lesson 1Lesson 1
Lesson 1
 
Rsa encryption
Rsa encryptionRsa encryption
Rsa encryption
 
Server side scripts
Server side scriptsServer side scripts
Server side scripts
 
Revision topic 1 sensors and control
Revision topic 1 sensors and controlRevision topic 1 sensors and control
Revision topic 1 sensors and control
 
Mtslesson
MtslessonMtslesson
Mtslesson
 
Hashing
HashingHashing
Hashing
 
Hashing
HashingHashing
Hashing
 
Gm names n stuff
Gm   names n stuffGm   names n stuff
Gm names n stuff
 
Reverse polish notation
Reverse polish notationReverse polish notation
Reverse polish notation
 

Graphs two

  • 1. Boris, Ben, Bob, Bess, Beth and Bill are waiting in a doctor’s surgery. Looking around the room, each of them sees that they know some of the other people in the room. Ben knows five of the other people sitting in the room, Bob knows four of the others, Beth and Bill both know three of the others, Bess knows two of the others and Boris only knows one of the other people. Who knows who in the waiting room?
  • 2. Adjacency Matrices • Directed and Undirected Graphs • Weighted graphs
  • 3. Adjacency Matrix or List • Matrix is fast and direct • Quick for adding and deleting edges • Not so good for adding and deleting vertices • Can be very ‘sparse’ and therefore inefficient
  • 4. Paths and Path problems • From one vertex to another along edges • Explorer’s problem • Path that travels each edge once and returns to starting point • Traveller’s problem • Path that visits each vertex only once before returning to starting point.
  • 5. Closed paths and cycles • Closed Path or circuit: Path that ends at the starting vertex • Cycle circuit for which each intermediate vertex is different • Tree Undirected connected graph with no cycles
  • 6. Closed paths and cycles • Closed Path or circuit: Path that ends at the starting vertex • Cycle circuit for which each intermediate vertex is different • Tree Undirected connected graph with no cycles