DOC PREVIEW
Duke CPS 100E - Graphs, the Internet, and Everything

This preview shows page 1-2-3-4-5 out of 14 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Graphs, the Internet, and EverythingIs there a Science of Networks?Jon KleinbergVocabularyTraversalsDepth-first search on GraphsBFS compared to DFSGraph implementationsGraph implementations (continued)Six Degrees of BaconHow does the Oracle work?How does the Oracle Work?Slide 13Center of the Hollywood Universe?CompSci 100e11.1Graphs, the Internet, and Everythinghttp://www.caida.org/CompSci 100e11.2Is there a Science of Networks?What kinds of networks are there?From Bacon numbers to random graphs to InternetFrom FOAF to Selfish Routing: apparent similarities between many human and technological systems & organizationModeling, simulation, and hypothesesCompelling concepts•Metaphor of viral spread•Properties of connectivity has qualitative and quantitative effectsComputer Science?From the facebook to tomogravityHow do we model networks, measure them, and reason about them?What mathematics is necessary?Will the real-world intrude?CompSci 100e11.3Jon Kleinberg2005 MacArthur Fellow, 2008 Infosys Award, 2008 Discover “20 Best Brains under 40”Networks course and bookCompSci 96 Spring 2010"....Try to keep an open mind about topics and areas going on....It's much easier to make progress on a problem when you are enjoying what you are doing. In addition to finding work that is important, find work that has some personal interest for you....I've benefited from a lot of mentoring throughout my career. I think it's important to pass it on to the next generation and work in a mentoring capacity or a teaching capacity with people entering the field....”ACM Infosys InterviewCompSci 100e11.4VocabularyGraphs are collections of vertices and edges (vertex also called node)Edge connects two vertices•Direction can be important, directed edge, directed graph•Edge may have associated weight/costA vertex sequence v0, v1, …, vn-1 is a path where vk and vk+1 are connected by an edge.If some vertex is repeated, the path is a cycleA graph is connected if there is a path between any pair of verticesWhat vertices are reachable from a given vertex?Traverse the graph…NYCPhilBostonWash DC20478190268394LGALAXORDDCA$186$186$412$1701$441CompSci 100e11.5TraversalsWhat vertices are reachable from a given vertex?Connected components?Degree: # edges incident a vertexStarting at Bacon where can we get?Random search, choose a neighboring vertex at random •Can we move in circles?Depth-first search, envision each vertex as a room, with doors leading out•Go into a room, mark the room, choose an unused door, exit–Don’t go into a room you’ve already been in (see mark)•Backtrack if all doors used (to room with unused door)•Used in Percolation assignmentRooms are stacked up, backtracking is really recursionOne alternative uses a queue: breadth-first searchCompSci 100e11.6Depth-first search on Graphspublic Set<Graph.Vertex> dfs(Graph.Vertex start){ Set<Graph.Vertex> visited = new TreeSet<Graph.Vertex>(); Stack<Graph.Vertex> qu = new Stack<Graph.Vertex>(); visited.add(start); qu.push(start); while (qu.size() > 0){ Graph.Vertex v = qu.pop(); for(Graph.Vertex adj : myGraph.getAdjacent(v)){ if (! visited.contains(adj)) { visited.add(adj); qu.push(adj); } } } return visited;}CompSci 100e11.7BFS compared to DFSpublic Set<Graph.Vertex> bfs(Graph.Vertex start){ Set<Graph.Vertex> visited = new TreeSet<Graph.Vertex>(); Queue<Graph.Vertex> qu = new LinkedList<Graph.Vertex>(); visited.add(start); qu.add(start); while (qu.size() > 0){ Graph.Vertex v = qu.remove(); for(Graph.Vertex adj : myGraph.getAdjacent(v)){ if (! visited.contains(adj)) { visited.add(adj); qu.add(adj); } } } return visited;}CompSci 100e11.8Graph implementationsTypical operations on graph:Add vertexAdd edge (parameters?)getAdjacent(vertex)getVertices(..)String->Vertex (vice versa)Different kinds of graphsLots of vertices, few edges, sparse graph•Use adjacency listLots of edges (max # ?) dense graph•Use adjacency matrixAdjacency listCompSci 100e11.9Graph implementations (continued)Adjacency matrixEvery possible edge represented, how many?Adjacency list uses O(V+E) spaceWhat about matrix?Which is better?What do we do to get adjacent vertices for given vertex?What is complexity?Compared to adjacency list?What about weighted edges?T F…CompSci 100e11.10Six Degrees of BaconBackgroundStanley Milgram’s Six Degrees of Separation?Craig Fass, Mike Ginelli, and Brian Turtle invented it as a drinking game at Albright CollegeBrett Tjaden, Glenn Wasson, Patrick Reynolds have run t online website from UVa and beyondInstance of Small-World phenomenonhttp://oracleofbacon.org handles 2 kinds of requests1. Find the links from Actor A to Actor B. 2. How good a center is a given actor?How does it answer these requests?CompSci 100e11.11How does the Oracle work?Not using Oracle™Queries require traversal of the graphBN = 0Mystic RiverApollo 13FootlooseJohn LithgowSarah Jessica ParkerBill PaxtonTom HanksSean PennTim RobbinsBN = 1Kevin BaconCompSci 100e11.12How does the Oracle Work?Kevin BaconMystic RiverApollo 13FootlooseJohn LithgowSarah Jessica ParkerBill PaxtonTom HanksSean PennTim RobbinsBN = 0BN = 1Sweet and LowdownFast Times at Ridgemont HighWar of the WorldsThe Shawshank RedemptionCast AwayForrest GumpTombstoneA Simple PlanMorgan FreemanSally FieldHelen HuntVal KilmerMiranda OttoJudge ReinholdWoody AllenBilly Bob ThorntonBN = 2BN = Bacon NumberQueries require traversal of the graphCompSci 100e11.13How does the Oracle work?Mystic RiverFootlooseJohn LithgowSarah Jessica ParkerTom HanksSean PennTim RobbinsBN = 0BN = 1Sweet and LowdownFast Times at Ridgemont HighWar of the WorldsThe Shawshank RedemptionCast AwayForrest GumpA Simple PlanMorgan FreemanSally FieldHelen HuntMiranda OttoJudge ReinholdWoody AllenBilly Bob ThorntonBN = 2Bill PaxtonTombstoneVal KilmerApollo 13Kevin BaconHow do we choose which movie or actor to explore next?Queries require traversal of the graphCompSci 100e11.14Center of the Hollywood Universe?1,018,678 people can be connected to BaconIs he the center of the Hollywood Universe?Who is?Who are other good centers?What makes them good centers?CentralityCloseness: the inverse


View Full Document

Duke CPS 100E - Graphs, the Internet, and Everything

Documents in this Course
Topics

Topics

9 pages

Lecture

Lecture

3 pages

Notes

Notes

2 pages

Hashing

Hashing

19 pages

Lecture

Lecture

59 pages

Lecture

Lecture

6 pages

Lecture

Lecture

4 pages

Lecture

Lecture

20 pages

Lecture

Lecture

12 pages

Lecture

Lecture

12 pages

Lecture

Lecture

7 pages

Lecture

Lecture

8 pages

Lecture

Lecture

10 pages

Lecture

Lecture

4 pages

Notes

Notes

16 pages

Lecture

Lecture

5 pages

Lecture

Lecture

9 pages

Lecture

Lecture

4 pages

Lecture

Lecture

13 pages

Lecture

Lecture

6 pages

Lecture

Lecture

16 pages

Lecture

Lecture

5 pages

Lecture

Lecture

5 pages

Lecture

Lecture

12 pages

Lecture

Lecture

12 pages

Lecture

Lecture

10 pages

Sets

Sets

14 pages

Lecture

Lecture

9 pages

Lecture

Lecture

4 pages

Test 1

Test 1

7 pages

Load more
Download Graphs, the Internet, and Everything
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Graphs, the Internet, and Everything and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Graphs, the Internet, and Everything 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?