CS101-09 Graphs

# CS101-09 Graphs - CJD 09 Graphs CJD Graphs G = Graph = a...

This preview shows pages 1–11. Sign up to view the full content.

CJD 09 Graphs

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

View Full Document
CJD Graphs G = Graph = a collection of vertices (or nodes) and connections between them = G(V,E) V = Vertex Set (the nodes) E = Edge Set (the connections) A B C D E F G H
CJD Applications Applications : Flights between airports Personal or material relationships Intersections and streets, Mazes Network connections between computers; the Internet Oil Pipelines

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

View Full Document
CJD Definitions Directed Graph = Digraph = where each edge is an ordered pair from a source vertex to a target vertex. Self-loops – edges from a vertex to itself – allowed in digraphs Undirected Graph = Simple Graph = where each edge is a set of two vertices. Self-loops are disallowed. Multigraph = Graph in which two vertices can be joined by multiple edges and self-loops are allowed. Two vertices are adjacent if there is an edge between them. Complete Graph = undirected graph where each pair of vertices are adjacent.
CJD Pictorial Representation of Graphs A B C D E F G H a b c d e f g h 1 5 6 3 7 V II 4 2 I IV III Undirected Graph Digraph Disconnected Tree U S T Complete

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

View Full Document
CJD More Definitions For undirected graphs : The degree of a vertex is the number of edges incident on it. For directed graphs : The in-degree of a vertex is the number of edges entering it. The out-degree of a vertex is the number of edges leaving it. Two graphs are isomorphic if their vertex and edge sets are the same after a suitable renaming. Graph G’(V’,E’) is a subgraph of G(V,E) if V’ V and E’ E and E' connects vertices in V'.
CJD More Definitions … (2) A Path of length k is a sequence <v 0 , v 1 , … v k > of vertices, each vertex is adjacent to the next. v is reachable from u if there is a path from u to v. A path is simple if the vertices in the path are distinct. The path is a cycle if v 0 = v k An undirected graph is connected if every pair of vertices is connected by a path A directed graph is strongly connected if every vertex is reachable from every other vertex. A tree is a connected, acyclic undirected graph

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

View Full Document
CJD Graph Representation A B C D E F G H 1. Adjacency Matrix 2. Adjacency List
CJD Adjacency Matrix Representation A table with as many rows and columns as the number of vertices of a graph. A table entry is 1 if an edge is incident from the vertex represented by that row to the vertex represented by that column. It is 0 otherwise. Symmetric for undirected graphs. A B C D E F G H A B C D E F G H A 0 1 1 1 0 0 0 0 B 1 0 0 1 1 0 0 0 C 1 0 0 1 0 0 0 0 D 1 1 1 0 1 1 0 0 E 0 1 0 1 0 0 0 0 F 0 0 0 1 0 0 1 1 G 0 0 0 0 0 1 0 0 H 0 0 0 0 0 1 0 0

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

View Full Document
CJD Adjacency List Representation For each vertex of a graph, there is a linked list of all vertices adjacent to it.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern