{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

cs251-week15 - Graphs A graph G =(V,E is composed of V set...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Graphs A graph G = (V,E) is composed of V: set of vertices E: set of edges connecting the vertices An edge e = (u,v0 is a path of vertices that indicates that vertices u and v are connected V = {A,B,C,D,E} E = {(A,B), (A,C), (B,C), (C,E), (C,D), (E,D)} Graphs are useful because many problems can be represented with graphs -- Communication network (internet) -- Transport network ( lab5 and google maps) -- Vertices -> cities / locations -- Edges -> roads / paths -- Event dependencies A D C E B R R R R H H H H
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Once you represent a problem using graphs, there are already many algorithms that can solve the problem Problem -> Graph -> Algorithms -> Solutions Algorithms -- shortest path algorithms -- topological sort -- spanning tree Undirected graphs: Graphs where edges do not have direction Directed graphs: Graphs where edges have a direction Data structures for graphs -- Edge list -- Adjacency list -- Adjacency matrix Edge list: It store the vertices and the edges as an edge list Edge List: {(A,B), (A,C), (B,D), (C,D), (D,F), (D,E), (F,E)} Adjacent List:
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}