COMP261 Lecture 3 Graphs 2 of 3. Locations (The Hardest Part of A1?) Three representations of a location/place/point latitude/longitude –what you need.

Slides:



Advertisements
Similar presentations
Data Structure and Algorithms (BCS 1223) GRAPH. Introduction of Graph A graph G consists of two things: 1.A set V of elements called nodes(or points or.
Advertisements

X y (x,y) x - coordinate y - coordinate. How are coordinates helpful?
Coordinate Plane 9/20. TOOLBOX: SUMMARY: Coordinate Plane: x and y-axis used to graph equations Quadrant II (neg, pos) Quadrant I (pos, pos) x-axis Origin.
1 Representing Graphs. 2 Adjacency Matrix Suppose we have a graph G with n nodes. The adjacency matrix is the n x n matrix A=[a ij ] with: a ij = 1 if.
TERMS, CONCEPTS and DATA TYPES IN GIS Orhan Gündüz.
Graph & BFS Lecture 22 COMP171 Fall Graph & BFS / Slide 2 Graphs * Extremely useful tool in modeling problems * Consist of: n Vertices n Edges D.
Dilations.
Chapter 9: Graphs Basic Concepts
COMP 175: Computer Graphics March 24, 2015
Physical Mapping of DNA Shanna Terry March 2, 2004.
Minimum Spanning Trees
Lesson 4.1- The Coordinate Plane, pg. 192
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Graphs.
Mathematical Induction II Lecture 21 Section 4.3 Mon, Feb 27, 2006.
Graphing With Coordinates
xy ? {(3,-2), (5,4), (-2,0)}. A relation is set of ordered pairs, where one number is mapped to another number.
PRE-ALGEBRA. Lesson 1-10 Warm-Up PRE-ALGEBRA Lesson 1-10 Warm-Up.
Transparency 6 Click the mouse button or press the Space Bar to display the answers.
Sets Goal: Introduce the basic terminology of set theory.
Transparency 9 Click the mouse button or press the Space Bar to display the answers.
The Coordinate Plane 1.10 p. 50 Learn to locate and graph points on the coordinate plane, name the coordinates of points, and identify the quadrants.
CHAPTER 2 Section 2.1. Objectives To graph a relation, state its domain and range, and determine if it is a function. To find values of functions for.
Advanced Algebra w/Trig
Relation. Combining Relations Because relations from A to B are subsets of A x B, two relations from A to B can be combined in any way two sets can be.
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.
DATA STRUCTURES AND ALGORITHMS Lecture Notes 10 Prepared by İnanç TAHRALI.
Graphs Basic properties.
Equations of Circles. You can write an equation of a circle in a coordinate plane, if you know: Its radius The coordinates of its center.
Graphs. Graph Definitions A graph G is denoted by G = (V, E) where  V is the set of vertices or nodes of the graph  E is the set of edges or arcs connecting.
Objective The student will be able to: graph ordered pairs on a coordinate plane.
Department of Computer Engineering Faculty of Engineering, Prince of Songkla University Graphs Original Slides by Rada Mihalcea.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Mining Complex Data COMP Seminar Spring 2011.
1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using.
Slope of a Line Unit 7 Review of Slope and Graphing Linear Equations.
Relations and Functions Objective: To use tables and graphs to represent relations and functions.
The Coordinate Plane Mr. Thiel.
Sets.
COMP261 Lecture 4 Graphs 3 of 3.
COMP 261 Lecture 17 Test Revision.
Click the mouse button or press the Space Bar to display the answers.
Graphs and Applications of Linear Equations
COMP 261 Lecture 2 Graphs 1 of 3.
Basic Concepts Graphs For more notes and topics visit:
1-6 Relations Goals: Represent relations as tables, ordered pairs, graphs and mappings. Eligible Content: A / A / A / A
You will learn to name and graph ordered pairs on a coordinate plane.
Quadrants and Reading Ordered Pairs
Coordinate Planes 2.2 I can identify the paths between points on a grid or coordinate plane and compare the lengths of the paths. 3.6 I can understand.
Planarity and Euler’s Formula
Chapter 9: Graphs Basic Concepts
3.1 Notes: Solving Systems of Equations
Graph Theory By Amy C. and John M..
Objective - To graph ordered pairs on the coordinate plane.
Discrete Mathematics Lecture 6: Set and Function
Lesson 4-1 The Coordinate Plane.
Motion in the Coordinate Plane
Discrete Mathematics Lecture 12: Graph Theory
Indicator 16 System of Equations.
1.7 Motion in the Coordinate Plane
Graphs G = (V, E) V are the vertices; E are the edges.
Mr. Britten’s Math Class Advanced Math due 11/19/2018 Name: __________________ 1. A coordinate system, or coordinate plane, is used to locate points.
Chapter 10 7th Grade Math.
1-6 Relations Goals: Represent relations as tables, ordered pairs, graphs and mappings. Eligible Content: A / A / A / A
GRAPHS Lecture 17 CS 2110 — Spring 2019.
11.3 Coordinate Plane Math 1.
Coordinate Graphing Quadrants and Reading Ordered Guided Notes
Chapter 9: Graphs Basic Concepts
The Coordinate Plane #39.
GRAPHS.
The two number lines are called the axes.
Graphing Ordered Pair – gives the location of a coordinate point
Presentation transcript:

COMP261 Lecture 3 Graphs 2 of 3

Locations (The Hardest Part of A1?) Three representations of a location/place/point latitude/longitude –what you need for locations on a sphere –This is what is in the data Location: x/y coordinates in kilometers –assume Auckland region is a flat plane (not quite true, but good enough) –This is what you need for finding shortest paths Point (x/y in pixels):positions on the screen in pixels –for drawing lines –mouse click positions  need to translate –lat/lon  x/y kms (use an appropriate formula) –x/y kms ↔ pixel coords depends on current origin and scale!

Location vs pixels. Look at the Location class! ORIGIN: pixel coordinates: 0, 0 location: , SCALE: 800 pixels 97.5 km

Data Structures for Graphs Need to represent the nodes and the edges Mathematical definition: set of nodes V = {v i }, set (or bag) of pairs (ordered or unordered) of nodes E ={(v i,v j )} Possible Data Structure: –Graph =set of Node objectsSet nodes; &set/bag of Edge objects Set edges; –Node = info about the node (label, etc) –Edge = info about the edge and its two nodes either two fields: node1, node2, or or Set (just 2 elements) –Issue: when are two edges counted as equal?

Possible Data Structure –Nodes –Edges Is this a good data structure? –How could we tell? –Depends on what we want to do with the graph. ABCDEFGH 15 A C 3AF3AF 12 B D 18 D B 6BH6BH 71 C B …… 22 C A 22 A C

More Data Structures for Graphs What do we need to do with a graph? Common actions on a graph: –list all the nodes –list all the edges –find all the neighbours of a node (nodes at other end of edge out of this node) –find all the nodes of which this node is a neighbour (nodes that have an edge to this node) –determine whether two nodes are connected or not –find the label/weight on the edge between two nodes What do we need for the Road Map? 15 maybe same if undirected

Auckland Roads: Display the map (and zoom in/out)  must access all the road elements and intersections Select roads (by name) –Show all roads matching what is typed so far –Highlight road on map.  must access roads by name, (and by prefix of name!)  must access description of all the road elements. Select intersections (by mouse click) –Highlight intersection  must access intersection by its location (nearest match) –Display names of roads at intersection.  must access all the roads for a given intersection

Reading data more efficiently File FileReader BufferedReader File roadFile = new File(dataDirectory+"roadID-roadInfo.tab"); BufferedReader data = new BufferedReader(new FileReader(roadFile)); String line = data.readLine(); String[] values = line.split("\t"); int n = Integer.parseInt(values[0]); double d = Double.parseDouble(values[1]);

More Data Structures for Graphs Structures for explicit graphs: “Traditional” Adjacency matrix “Traditional” Adjacency lists Object and Collection based representations Structures for implicit graphs: Node objects and neighbour functions.