 # Graphs. Graph A “graph” is a collection of “nodes” that are connected to each other Graph Theory: This novel way of solving problems was invented by a.

## Presentation on theme: "Graphs. Graph A “graph” is a collection of “nodes” that are connected to each other Graph Theory: This novel way of solving problems was invented by a."— Presentation transcript:

Graphs

Graph A “graph” is a collection of “nodes” that are connected to each other Graph Theory: This novel way of solving problems was invented by a Swiss mathematician, Leonhard Euler

Königsberg Bridge Problem Euler was considering the layout of the bridges in the city Königsberg. The city was unusual in that it was built on an island in the river Pregel The problem Euler was considering was to determine if it was possible for one to walk over all seven bridges exactly once and end up exactly where one started.

a d bc Graph of Bridges of Königsberg

Graph Notation A graph is a set of nodes or vertices V that are joined by a set of edges E. V = {A,B,C} E={e 1, e 2, e 3 } Graph G = (V,E) A C B e3 e2 e1

Directed and Undirected Graphs A graph is called a directed graph if the edge from vertex v 1 to vertex v 2 can only be traveled in that specific direction, and not in the reverse direction. Directed edges are represented as an ordered pair (v 1, v 2 )

Directed Graph Edge Set E = {(r, u), (u, r), (w, r), (u, w)} Vertex Set V = {u, r,w}

Complete Graph A graph in which every vertex is connected by an edge to every other vertex A complete graph on n vertices has n vertices and n(n − 1) / 2 edges

a be c f d 1.How many vertices are there? 2.How many edges are there? 3.Is this a directed or undirected graph? 4.Is this a complete graph? 5.What are the set of vertices V and the set of edges E?

Walks, Trails, and Circuits A walk is any sequence of vertices and edges starting at some vertex v 0 and ending at a vertex v n. A trail is a walk in which no edge is traversed more than once. A circuit is a walk that begins and ends at the same vertex. A graph is connected if there is a walk from any vertex v 1 to any other vertex v 2.

Euler Circuits Euler trail is a trail that includes every vertex in the graph. An Euler circuit is an Euler trail that begins and ends at the same vertex. If any vertex in a graph is of odd degree (odd number of edges), the graph does not have an Euler circuit.

Weighted Graphs Philadelphia Washington DC New York 82 220 266 209 127 392 Boston

Spanning Tree A spanning tree is a special kind of subgraph of graph G that includes all the vertices that are in G (not necessarily all the edges) and in which there are no cycles or loops possible.

Minimum Spanning Tree (MST) A spanning tree that has the least weight of all the spanning trees of G. Prim's Algorithm for the Minimum Spanning Tree 1.Write all the edges in the graph in order from smallest to biggest weight. 2.Working from smallest to biggest, add each edge into the MST only if it does not make a cycle. Stop when all the vertices are in the graph and the graph is connected (there are no isolated vertices).

Download ppt "Graphs. Graph A “graph” is a collection of “nodes” that are connected to each other Graph Theory: This novel way of solving problems was invented by a."

Similar presentations