Posted by: davidrag | October 10, 2010

Lec 17: 10/8/2010

(Guest post by David Ragsdale)

In this lecture we talked about graph representations. More importantly we talked about the running times of an adjacency matrix and an adjacency list.

Here are the running times as followed:
(u,v) in E:
1. adjacency matrix O(1)
2. adjacency list O(n) [ O(n_v)]
all neighbors of u:
adjacency matrix O(n)
adjacency list O(n_u)
adjacency matrix O(n^2)
adjacency list: O(m+n)

we claimed that m =< (m choose 2) = n(n-1)/2 =< n^2
(u,v) \epsilon E <-> (v,u) \epsilon v x V
abs(E) =< # of unordered pairs (u,v)  \epsilonv xV

space for adj. list  O(n +  \Sigma_{u\epsilon V}n_u)

we also claim that  \Sigma_{u\epsilon V}n_u = 2m


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


%d bloggers like this: