Graphs.

Slides:



Advertisements
Similar presentations
Graphs CSC 220 Data Structure. Introduction One of the Most versatile data structures like trees. Terminology –Nodes in trees are vertices in graphs.
Advertisements

©Brooks/Cole, 2003 Chapter 12 Abstract Data Type.
Data Structures ( 数据结构 ) Chapter 10:Graphs. Vocabulary Graph 图 Vertex 顶点 Edge 边 Arc 弧 Directed Graph 有向图 Undirected Graph 无向图 Adjacent Vertices 邻接点 Path.
Graphs CS-240/341. Uses for Graphs computer networks and routing airline flights geographic maps course prerequisite structures tasks for completing a.
Introduction to Graphs
©Brooks/Cole, 2003 Chapter 12 Abstract Data Type.
Chapter 11 Graphs and Trees This handout: Terminology of Graphs Eulerian Cycles.
C o n f i d e n t i a l HOME NEXT Subject Name: Data Structure Using C Unit Title: Graphs.
Chapter 9 – Graphs A graph G=(V,E) – vertices and edges
Computer Science 112 Fundamentals of Programming II Introduction to Graphs.
© 2006 Pearson Addison-Wesley. All rights reserved14 A-1 Chapter 14 Graphs.
1 abstract containers hierarchical (1 to many) graph (many to many) first ith last sequence/linear (1 to 1) set.
Introduction to Graphs. Introduction Graphs are a generalization of trees –Nodes or verticies –Edges or arcs Two kinds of graphs –Directed –Undirected.
 What is a graph? What is a graph?  Directed vs. undirected graphs Directed vs. undirected graphs  Trees vs graphs Trees vs graphs  Terminology: Degree.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Graphs.
1 CS104 : Discrete Structures Chapter V Graph Theory.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Graphs.
Graphs. 2 Graph definitions There are two kinds of graphs: directed graphs (sometimes called digraphs) and undirected graphs Birmingham Rugby London Cambridge.
Computer Science: A Structured Programming Approach Using C Graphs A graph is a collection of nodes, called vertices, and a collection of segments,
CISC 235: Topic 9 Introduction to Graphs. CISC 235 Topic 92 Outline Graph Definition Terminology Representations Traversals.
Graph Theory. A branch of math in which graphs are used to solve a problem. It is unlike a Cartesian graph that we used throughout our younger years of.
Chapter 12 Abstract Data Type. Understand the concept of an abstract data type (ADT). Understand the concept of a linear list as well as its operations.
Graphs A graphs is an abstract representation of a set of objects, called vertices or nodes, where some pairs of the objects are connected by links, called.
1 Directed Graphs Chapter 8. 2 Objectives You will be able to: Say what a directed graph is. Describe two ways to represent a directed graph: Adjacency.
Graphs G = (V,E) V is the vertex set. Vertices are also called nodes and points. E is the edge set. Each edge connects two different vertices. Edges are.
GRAPHS. Graph Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component, spanning tree Types of graphs: undirected,
Graphs Upon completion you will be able to:
Chapter 9: Graphs.
Graph Representations And Traversals. Graphs Graph : – Set of Vertices (Nodes) – Set of Edges connecting vertices (u, v) : edge connecting Origin: u Destination:
Data Structures( 数据结构 ) Course 12:Graphs. 2 西南财经大学天府学院 Vocabulary Graph 图 Vertex 顶点 Edge 边 Arc 弧 Directed Graph 有向图 Undirected Graph 无向图 Adjacent Vertices.
Subject Four Graphs Data Structures. What is a graph? A data structure that consists of a set of nodes (vertices) and a set of edges that relate the nodes.
Chapter 12 Abstract Data Type.
Unit 10 Graphs (1) King Fahd University of Petroleum & Minerals
Data Structures Graphs - Terminology
Introduction to Graphs
Basic Concepts Graphs For more notes and topics visit:
Graphs.
CS 367 – Introduction to Data Structures
Introduction to Graphs
Graphs and Graph Models
Refresh and Get Ready for More
abstract containers sequence/linear (1 to 1) hierarchical (1 to many)
Can you draw this picture without lifting up your pen/pencil?
Graphs Chapter 13.
abstract containers sequence/linear (1 to 1) hierarchical (1 to many)
Graphs CSE 2011 Winter November 2018.
Graphs All tree structures are hierarchical. This means that each node can only have one parent node. Trees can be used to store data which has a definite.
Graphs Chapter 11 Objectives Upon completion you will be able to:
CS100: Discrete structures
Graphs.
Graph Theory By Amy C. and John M..
Graphs ORD SFO LAX DFW Graphs Graphs
Chapter 14 Graphs © 2006 Pearson Addison-Wesley. All rights reserved.
Graphs By Rajanikanth B.
Graphs Chapter 7 Visit for more Learning Resources.
Graphs.
Graphs G = (V, E) V are the vertices; E are the edges.
GRAPHS G=<V,E> Adjacent vertices Undirected graph
abstract containers sequence/linear (1 to 1) hierarchical (1 to many)
Graphs.
Graphs.
CSC 380: Design and Analysis of Algorithms
Graphs.
Chapter 10 Graphs and Trees
Graphs.
GRAPHS.
Heaps Chapter 6 Section 6.9.
Introduction to Graphs
For Friday Read chapter 9, sections 2-3 No homework
Introduction to Graphs
Presentation transcript:

Graphs

Graphs Graphs is a data structure that differ from all the others in one major concept , each node may have multiple predecessors as well as multiple successors . Graphs are very useful structure . They can be used to solve complex routing problems ,such as : * designing and routing airlines among the air ports they serve . * route messages over a computer network from one node to another .

Terminology Graph collection of nodes (vertices) collection of line segments connecting vertices (edges) Graph may be : Directed Each line segment has a direction (Arc) to its successor Undirected No direction on any line segment (Edge)

Neighbors Two vertices are said to be neighbors if an edge directly connects them Path A sequence of vertices in which each vertex is adjacent to the other Cycle A path that start and ends with the same vertex Loop A single Arc that begins and ends with the same vertex

Strongly connected If there is a path from each vertex to every other vertex in the directed graph . Weakly connected If at least two vertices are not connected Disjoint A graph is disjoint if it not connected

Weakly connected A B E G F C D H I

Strongly connected A B E G F C D H I

Disjoint A B E G F C D H I

Degree of vertex Is the number of lines incident to it . Out degree of vertex in digraph Is the number of arcs leaving the vertex Indegree Is the number of arcs entering the vertex

Operations Add Vertex Insert a new vertex in the graph When a vertex is added it is disjoint , it is not connected to any other vertices in the list . B A B A AddVertix C C E E

Delete Vertex Removes a vertex from the graph .When a vertex is deleted , all connecting edges are removed . B A B A C E C E

Connect a vertex to a destination vertex . Add edge Connect a vertex to a destination vertex . If the graph is a digraph , then one of the edges must be the source and the other is the destination . B A B A C E C E

Find Vertex Traverse the graph looking for a specified vertex. If the vertex is found , its data are returned . If it is not founded , an error is indicated .

Graph Storage Structures To represent a graph , we need to store two sets : The vertices of the graph The edges or arcs . The two common structures used to store these sets are array and linked list .

Adjacency matrix Uses a vector ( one –dimensional array ) for the vertices and a matrix (two - dimensional array) to store the edges .

Adjacency list Uses a two- dimensional ragged array to store the edges . The vertex list is a singly linked list of the vertices in the list .