9
Graph Algorithms Represent ing Graphs Design and Analysis of Algorithms I

Representing Graphs

  • Upload
    luther

  • View
    34

  • Download
    0

Embed Size (px)

DESCRIPTION

Graph Algorithms. Representing Graphs. Design and Analysis of Algorithms I. Graphs. Consider an undirected graph that has vertices, no parallel edges, and is connected (i.e., “in one piece”). What is the minimum and maximum number of edges that the graph could have, respectively?. and . - PowerPoint PPT Presentation

Citation preview

Page 1: Representing Graphs

Graph AlgorithmsRepresenting Graphs

Design and Analysis of Algorithms I

Page 2: Representing Graphs

Tim Roughgarden

Graphs

Page 3: Representing Graphs

and

𝑛−1  and  𝑛2

𝑛   and  2𝑛

𝑛   and  𝑛𝑛

Consider an undirected graph that has vertices, no parallel edges, and is connected (i.e., “in one piece”). What is the minimum and maximum number of edges that the graph could have, respectively?

Page 4: Representing Graphs

Tim Roughgarden

Sparse vs. Dense Graphs

Page 5: Representing Graphs

Tim Roughgarden

The Adjacency Matrix

Page 6: Representing Graphs

𝜃(𝑛)𝜃(𝑚)𝜃(𝑚+𝑛)𝜃(𝑛2)

How much space does an adjacency matrix require, as a function of the number of vertices and the number of edges?

Page 7: Representing Graphs

Tim Roughgarden

Adjacency Lists

Page 8: Representing Graphs

𝜃(𝑛)𝜃(𝑚)𝜃(𝑚+𝑛)𝜃(𝑛2)

How much space does an adjacency list representation require, as a function of the number of vertices and the number of edges?

Page 9: Representing Graphs

Tim Roughgarden

Adjacency Lists