Whats left? How do we get from here to there? Need: 1. Common - - PowerPoint PPT Presentation

what s left
SMART_READER_LITE
LIVE PREVIEW

Whats left? How do we get from here to there? Need: 1. Common - - PowerPoint PPT Presentation

Announcements PA3 available, due 03/30, 11:59p. Graphs!! G = (V,E) Tree: Simple (sub)Graph: Spanning subgraph: Connected (sub)Graph: Spanning tree: Connected component: G = (V,E) Graph Vocabulary: Use the graph G to answer these questions.


slide-1
SLIDE 1

Announcements PA3 available, due 03/30, 11:59p.

Graphs!! G = (V,E)

Connected (sub)Graph: Connected component: Tree: Simple (sub)Graph: Spanning subgraph: Spanning tree:

slide-2
SLIDE 2

Graph Vocabulary: Use the graph G to answer these questions.

1. List the edges incident on vertex b: 2. What is the degree of vertex h? 3. List all the vertices adjacent to vertex i: 4. Describe a path from p to o: 5. Describe a path from 6 to g: 6. List the vertices in the largest complete subgraph in G: 7. Describe the smallest connected subgraph in G: 8. Describe the connected components in G: 9. How many edges in a spanning forest of G?

  • 10. How many paths from 0 to 9?
  • 11. Can you draw G with no crossing edges?

G = (V,E) |V| = n |E| = m

slide-3
SLIDE 3

How do we get from here to there? Need:

  • 1. Common Vocabulary
  • 2. Graph implementation
  • 3. Traversal
  • 4. Algorithms.

What’s left?

slide-4
SLIDE 4

Graphs: theory that will help us in analysis

How many edges?

At least: connected – not connected - At most: simple - not simple - Relationship to degree sum: X U V W Z Y a c b e d f g h G = (V,E) |V| = n |E| = m

Running times often reported in terms of n, the number

  • f vertices, but they often depend on m, the number of

edges.

slide-5
SLIDE 5

Thm: Every minimal connected graph G=(V,E) has |V|-1 edges.

Proof: Consider an arbitrary minimal connected graph G=(V,E).

Lemma: Every connected subgraph of G is minimally connected. (easy proof by contradiction) IH: For any j < |V|, any minimal connected graph of j vertices has j-1 edges. X U V W Z Y a c e f h

Suppose |V| = 1: A minimal connected graph of 1 vertex has no edges, and 0 = 1-1. Suppose |V| > 1: Choose any vertex and let d denote its degree. Set aside its

incident edges, partitioning the graph into _______ components, C0=(____,____), ... Cd=(____, ____), each of which is a minimal connected subgraph of G. This means that |Ek| = ________ by _____. Now we’ll just add up edges in the original graph:

slide-6
SLIDE 6

Graphs: Toward implementation…(ADT)

Data:

Vertices Edges + some structure that reflects the connectivity of the graph

X V W Z Y b e d f g h

Functions: (merely a smattering…)

insertVertex(pair keyData) insertEdge(vertex v1, vertex v2, pair keyData) removeEdge(edge e); removeVertex(vertex v); incidentEdges(vertex v); areAdjacent(vertex v1, vertex v2);

  • rigin(edge e);

destination(edge e);

slide-7
SLIDE 7

Graphs: Adjacency Matrix

v u w a c b z d a b c d

u v w z u v w z

u v w z

Some functions we’ll compare: insertVertex(vertex v) removeVertex(vertex v) areAdjacent(vertex v, vertex u) incidentEdges(vertex v)

slide-8
SLIDE 8

Graphs: Adjacency List

v u w a c b z d a b c d u v w z

Some functions we’ll compare: insertVertex(vertex v) removeVertex(vertex v) areAdjacent(vertex v, vertex u) incidentEdges(vertex v)