These definitions cover some basic terms and concepts of graph theory and how they have been implemented as C++ classes.

Similar documents
Classes Fa thru Kz. Chapter 32. FACE

Chapter 9: Elementary Graph Algorithms Basic Graph Concepts

Chapter 8 Topics in Graph Theory

Design and Analysis of Algorithms

Analysis of Algorithms Prof. Karen Daniels

Geometric Modeling. Introduction

Lesson 22: Basic Graph Concepts

5 Graphs

Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103. Chapter 2. Sets

3.1 Basic Definitions and Applications

Number System. Introduction. Natural Numbers (N) Whole Numbers (W) Integers (Z) Prime Numbers (P) Face Value. Place Value

Fundamental Properties of Graphs

A graph is finite if its vertex set and edge set are finite. We call a graph with just one vertex trivial and all other graphs nontrivial.

TCOM 501: Networking Theory & Fundamentals. Lecture 11 April 16, 2003 Prof. Yannis A. Korilis

Graph Theory. Connectivity, Coloring, Matching. Arjun Suresh 1. 1 GATE Overflow

1. Draw the state graphs for the finite automata which accept sets of strings composed of zeros and ones which:

Geometric Constructions

Lesson 5.5. Minimum Spanning Trees. Explore This

Chapter 12 Solid Modeling. Disadvantages of wireframe representations

2.2 Set Operations. Introduction DEFINITION 1. EXAMPLE 1 The union of the sets {1, 3, 5} and {1, 2, 3} is the set {1, 2, 3, 5}; that is, EXAMPLE 2

L10 Graphs. Alice E. Fischer. April Alice E. Fischer L10 Graphs... 1/37 April / 37

Eulerian Cycle (2A) Young Won Lim 5/11/18

Relational Database: The Relational Data Model; Operations on Database Relations

CHAPTER-2 A GRAPH BASED APPROACH TO FIND CANDIDATE KEYS IN A RELATIONAL DATABASE SCHEME **

A GRAPH FROM THE VIEWPOINT OF ALGEBRAIC TOPOLOGY

Boolean Component. Chapter 1. Boolean Operations

A set with only one member is called a SINGLETON. A set with no members is called the EMPTY SET or 2 N

GRAPH THEORY. What are graphs? Why graphs? Graphs are usually used to represent different elements that are somehow related to each other.

Bayesian Networks and Decision Graphs

Chapter 1. Linear Equations and Straight Lines. 2 of 71. Copyright 2014, 2010, 2007 Pearson Education, Inc.

1. Introduction to Constructive Solid Geometry (CSG)

Slides for Faculty Oxford University Press All rights reserved.

SETS. Sets are of two sorts: finite infinite A system of sets is a set, whose elements are again sets.

Curves and Surfaces. Chapter 7. Curves. ACIS supports these general types of curves:

Solid Modeling Lecture Series. Prof. Gary Wang Department of Mechanical and Manufacturing Engineering The University of Manitoba

Note. Out of town Thursday afternoon. Willing to meet before 1pm, me if you want to meet then so I know to be in my office

Geometry Unit 4a - Notes Triangle Relationships

Network Topology and Graph

Geometric Modeling Mortenson Chapter 11. Complex Model Construction

Polygon Meshes and Implicit Surfaces

Polygon Meshes and Implicit Surfaces

Lesson 4.2. Critical Paths

Chapter 3. Set Theory. 3.1 What is a Set?

Computer Aided Engineering Design Prof. Anupam Saxena Department of Mechanical Engineering Indian Institute of Technology, Kanpur.

SAMPLE. MODULE 5 Undirected graphs

Discrete Mathematics

A.1 Numbers, Sets and Arithmetic

A region is each individual area or separate piece of the plane that is divided up by the network.

CSC Discrete Math I, Spring Sets

The clique number of a random graph in (,1 2) Let ( ) # -subgraphs in = 2 =: ( ) We will be interested in s.t. ( )~1. To gain some intuition note ( )

Domination, Independence and Other Numbers Associated With the Intersection Graph of a Set of Half-planes

The clique number of a random graph in (,1 2) Let ( ) # -subgraphs in = 2 =: ( ) 2 ( ) ( )

GEOMETRY BASIC GEOMETRICAL IDEAS. 3) A point has no dimensions (length, breadth or thickness).

Chapter 6. Planar Orientations. 6.1 Numberings of Digraphs

Geometric Entities for Pilot3D. Copyright 2001 by New Wave Systems, Inc. All Rights Reserved

Spanning Trees. CSE373: Data Structures & Algorithms Lecture 17: Minimum Spanning Trees. Motivation. Observations. Spanning tree via DFS

11/1/13. Polygon Meshes and Implicit Surfaces. Shape Representations. Polygon Models in OpenGL. Modeling Complex Shapes

Vertex-Based (Lath) Representations for Three-Dimensional Objects and Meshes p.1/15

Algorithm Design (8) Graph Algorithms 1/2

Graph Theory S 1 I 2 I 1 S 2 I 1 I 2

The Three Dimensional Coordinate System

Depth-First Search A B D E C

9/19/12. Why Study Discrete Math? What is discrete? Sets (Rosen, Chapter 2) can be described by discrete math TOPICS

CS100: DISCRETE STRUCTURES

Unit 1, Lesson 1: Moving in the Plane

The Graphs of Triangulations of Polygons

CS302 - Data Structures using C++

Fault Tree Analysis (Minimal Cutset)

Section 3.1: Nonseparable Graphs Cut vertex of a connected graph G: A vertex x G such that G x is not connected. Theorem 3.1, p. 57: Every connected

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI

Definition For vertices u, v V (G), the distance from u to v, denoted d(u, v), in G is the length of a shortest u, v-path. 1

Extracting consistent and manifold interfaces from multi-valued volume data sets

Graph Theory: Introduction

Planar Graphs. 1 Graphs and maps. 1.1 Planarity and duality

4.4 3D Shape Interpolation - changing one 3D object into another

A simple problem that has a solution that is far deeper than expected!

Set and Set Operations

CSE 332: Data Structures & Parallelism Lecture 19: Introduction to Graphs. Ruth Anderson Autumn 2018

Lesson 4: Surface Re-limitation and Connection

Chapter 4. Relations & Graphs. 4.1 Relations. Exercises For each of the relations specified below:

Perimeter Magic Polygons

Symmetric Product Graphs

Generating All Simple Convexly-Drawable Polar Symmetric 6-Venn Diagrams

Hamiltonian cycles in bipartite quadrangulations on the torus

Graphs: Topological Sort / Graph Traversals (Chapter 9)

Binary Relations McGraw-Hill Education

Math 222 (A1) Solutions to Assignment 4

CS S Lecture February 13, 2017

27 Geometric Intersection

Two Characterizations of Hypercubes

Review of Sets. Review. Philippe B. Laval. Current Semester. Kennesaw State University. Philippe B. Laval (KSU) Sets Current Semester 1 / 16

Key Graph Theory Theorems

Module 5 Graph Algorithms

Math 202 Test Problem Solving, Sets, and Whole Numbers 19 September, 2008

NP-Complete Problems

Mathematics and Symmetry: A Bridge to Understanding

Lecture 5: More Examples/Applications of Quasirandom Graphs

Curriki Geometry Glossary

CPS222 Lecture: Sets. 1. Projectable of random maze creation example 2. Handout of union/find code from program that does this

Dominating Sets in Triangulations on Surfaces

Transcription:

hapter 5. raph Theory *raph Theory, *Mathematics raph theory is an area of mathematics which has been incorporated into IS to solve some specific problems in oolean operations and sweeping. It may be also be used to solve other problems in geometric modeling. graph is a mathematical abstraction of relationships. Many real-world situations can conveniently be described through a diagram or graph consisting of a set of points (nodes or vertices) together with lines (edges) joining various pairs of these points. This graphical representation helps us understand connectivity relationships and is the basis for graph theory. In graph diagrams, one is mainly interested in whether or not two given points are joined by a line. The manner in which they are joined long line, short line, straight line, curved line is immaterial, and the relative positions of the vertices and edges have no significance. There is no unique way of drawing a graph. The graph theory subset of IS laws provides a generic way of dealing with finite combinations of objects that have some relation to each other. The graph theory laws deal with the discrete, not continuous, part of mathematics. efinitions *raph Theory These definitions cover some basic terms and concepts of graph theory and how they have been implemented as ++ classes. relation is a set of ordered pairs. If all of the elements of the ordered pairs come from a set S, then the relation may be said to be on the set S. relation R is called symmetric if for each ordered pair (a,b) in R, the ordered pair (b,a) is also in R. graph is a symmetric relation on a set V representing the vertices of S. The ordered pairs of a graph are called edges of the graph. No distinction is made between the pair (a,b) and the pair (b,a). The vertices a and b are said to be adjacent to the edge (a,b). The edge (a,b) is said to be adjacent to the vertices a and b.

path is a distinct sequence of vertices v, v 1, v 2,..., v n such that for all i<n, v i is adjacent to v i+1. The vertex v is the start of the path. The vertex v n is the end of the path. The integer n is the length of the path. Sometimes the graph defined by the sequence of vertices together with the edges that connect them is also called a path. n example of a path in igure 5-1 would be the sequence of vertices (,,,, ). graph is called connected if given any two vertices a and b in, there is a path in from a to b. The graph in igure 5-1 is not connected, because there is no path from the vertex to the vertex K. graph S is called a subgraph of if every vertex and edge in S is also in. maximum connected subgraph of is called a component of. igure 5-1 shows a graph with three components, vertices L, and ten edges. igure 5-2 shows a subgraph and one of the three components of the graph depicted in igure 5-1. I J K L igure 5-1. xample of a raph igure 5-2. xample of a Subgraph

cycle is a sequence of at vertices v, v 1, v 2,..., v n such that v = v n and v, v 1, v 2,..., v n 1 is a path. graph is called a cycle if it is connected and non empty and if every vertex is of degree two. vertex v is called a cycle vertex of the graph if v belongs to a cycle in the graph. The degree of a vertex is the number of adjacent edges to the vertex. The distance between two vertices in a graph is the length of the shortest path in the graph from one vertex to the other. In igure 5-2, the sequence of vertices (,,,,, ) is a cycle, with each being a cycle vertex. The vertices and are not cycle vertices. The degree of vertices,, and J from igure 5-1 is three. The degree of vertices,, and is two, while the degree of vertices,, I, K, and L is one and the degree of vertex is zero. graph is called a tree if it is connected and does not contain a cycle. graph is called linear if it is a tree and if it does not contain a vertex of degree greater than two. The concepts of vertex, edge, and graph have been implemented as the ++ classes gvertex, gedge, and generic_graph. (entity_gvertex is derived from gvertex except that it contains a pointer to an entity in the model. Such an entity could be a cell or a face.) gvertex may be created with an optional char *name. gedge may be created with two gvertex pointers. n empty graph may be created and edges and vertices may be added to it by calling its add_vertex and add_edge methods. Once created, a graph may be interrogated, ordered, or subsetted in a number of ways. The generic_graph class has methods to tell if a graph is: connected a tree linear a cycle It also has methods to tell how many components the graph has and to return each of the components as a subgraph. The components may also be identified by giving an edge or vertex in them. Real World raph Theory *raph Theory One use of graph theory in geometric modeling is to abstract a given model s cells into a graph. ach cell of the geometric model becomes a point of the graph. Points of the graph are connected with lines (or edges) only if the cells of the geometric model are adjacent with faces. nother use of graph theory is to abstract a given model s faces into a graph. ach face of the geometric model becomes a point of the graph. Points of the graph are connected with lines (or edges) only if the faces of the geometric model are adjacent.

In either case, once a graph has been obtained, the graph subsystem can be used to find the shortest path, the shortest cycle, the cut edges and vertices, etc. n example of using graph theory in IS is in selective ooleans and sweeping. ells used as part of sweeping are passed into the graph subsystem. Using graph theory, the shortest path is calculated and used to trim the trees of the graph. Mapping this result back to the original cells (and entities) determines which portions of the resulting swept model to keep and which to throw away. oolean Operations on raphs *raph Theory The graph theory subsystem provides for four types of oolean operations: unite, intersect, subtract and lose boundary, and subtract and keep boundary. igure 5-4 shows the union of graph 1 and graph 2, shown in igure 5-. The result is a graph whose vertices and edges are the union of the vertices and edges of the original graph. s such, there are no duplicate vertices and edges even though they appear in the individual graphs. raph 1 raph 2 igure 5-. raphs 1 and 2 for oolean Operations igure 5-4. raph 1 Union with raph 2

igure 5-5 shows the intersection of the two graphs which keeps only those vertices and edges that are common to both. igure 5-5. raph 1 Intersected with raph 2 igure 5-6 and igure 5-7 show the subtraction operations. The result of subtraction can be ambiguous, because an edge (such as ) might be half in a graph. or this reason the subtract method of generic_graph takes a logical option that tells if such edges should be kept or not. igure 5-6 shows graph 2 subtracted from graph 1 with half edges not kept and igure 5-7 show the half edges being kept. igure 5-6. raph 2 Subtracted from raph 1 Not Keeping oundary

igure 5-7. raph 2 Subtracted from raph 1 Keeping oundary Types of dges and Vertices *raph Theory vertex v is called a cut vertex of the graph if removing the vertex v and the boundary edges from results in more components than. n edge e is called a cut edge of the graph if removing the edge e from results in more components than. When an edge is removed from a graph, its vertices are left in. Vertices,,, and are cut vertices of the graph in igure 5-8, because removing them from the graph results in more components. I igure 5-8. ut Vertices, ut dges, and ycle Vertices igure 5-9 top shows what happens when vertex is cut from the graph, resulting in two components. Likewise, edges - and - are cut edges of the graph. igure 5-9 bottom shows what happens when edge is cut from the graph, resulting in two components. Vertices,,,,,,, and I are cycle vertices of the graph depicted in igure 5-8.

I I igure 5-9. Resulting raphs Minus a ut Vertex and a ut dge lass methods from generic_graph associated with cut vertices and edges include cut_vertices, is_cut_vertex, cut_edges, and is_cut_edge. Scheme extensions include graph:cut vertices, graph:cut_vertex?, graph:cut edges, and graph:cut_edge?. Ordering raphs *raph Theory Ordering a graph in some manner is one of the more fundamental graph operations that yields a wealth of important relationship information. One way is to order the vertices by the distance, or hops, that they are from a given vertex. The distance is not the length of the lines drawn for the edges, but the number of vertices encountered when tracing along the edges from one vertex to another specified vertex. The distance between two vertices in a graph is the number of vertices of the shortest path in the graph from one vertex to the other. The order from method of ordering a graph works well for trees and linear graphs. The two graphs show in igure 5-1 have been ordered by distance from vertex. ecause ordering uses a single vertex as the starting point, it is possible to have multiple nodes in a graph that are the same distance away, as is shown with,, and, or and.

1 2 4 4 1 2 4 igure 5-1. Ordering raphs If a graph is cyclic, then it may be ordered by the order_cyclic method. This sets a given vertex s order to zero and the other vertices in a clockwise cyclic order as shown in igure 5-11. 1 2 5 4 igure 5-11. yclic Ordering oth order_cyclic and order from ordered graphs may be negated, and they negate in different ways. igure 5-12 shows the negations of the graphs from igure 5-1 and igure 5-11. ecause ordering uses a single vertex as the starting point, it is possible to have multiple nodes in a negated ordered graph that are, as is shown with and.

1 4 2 1 4 2 1 1 5 4 1 2 igure 5-12. Negation of the Ordering in raphs nother way to order a graph is to order it with respect to an ordered graph such that is a subgraph of. The order_with method imposes the order of onto and rescales the ordering on to remove gaps. The type of ordering (i.e. cyclic or not) is inherited from the ordered graph. igure 5-1 shows a linear graph imposing its order on a subgraph. raph 1 2 4 Subgraph 1 2 igure 5-1. Ordering a raph with another raph igure 5-14 shows a cyclic graph imposing its order on a subgraph.

1 2 1 5 4 2 igure 5-14. Ordering raphs Once a graph has been ordered, the order of a vertex may be found by calling the get_order method and the maximum order in the graph may be found by calling the max_order method. iven an ordered graph, a subgraph may be formed by calling either of the two subset methods of the generic_graph class. One method takes in two integers and the other takes a law pointer. The subset method with two integers takes a and b and returns a subgraph in one of two ways. If a<b, then the set of all vertices with orders between a and b is returned along with all edges that have both of their adjacent vertices in this set. If b<a, then the set of all vertices with orders not between a and b is returned along with all edges that have both of their adjacent vertices in this set. The subset method with a law returns the set of all vertices such that their order evaluates as true along with the all edges that have both of their adjacent vertices evaluating as true orders. In igure 5-15, the graph on the left has been ordered and subsetted from 1 to, resulting in the graph on the right.

1 2 4 4 igure 5-15. Ordered and Subsetted from 1 to In igure 5-16, the graph on the left has been ordered and subsetted from 4 to 1, resulting in the graph on the right. Note that this is a cyclic graph in ascending order. ence, the result is (,,, ) instead of (,,, ). 1 2 5 4 igure 5-16. Ordering raphs In igure 5-17, the graph on the top has been subsetted with the law even?(x) which returns true if x is even. In addition to even?, the laws odd?, int?, and prime? are available.

1 2 4 igure 5-17. Ordering a raph with another raph lass methods from generic_graph associated with ordering include subset, order_from, order_cyclic, order_with, negate, get_order, and max_order; while Scheme extensions include graph:get order, graph:order cyclic, graph:order with, graph:order from, graph:show order, and graph:negate. Other Ways to reate raphs *raph Theory method has also been added to return a subgraph that is a shortest path between two vertices in the same component of a graph. The shortest path from to in igure 5-18 is the path (,,,, ). or cycle vertices, a method has been added to return a subgraph that is a shortest cycle that contains the vertex. The shortest cycle of the graph in igure 5-18 that contains is the cycle (,,,, ). igure 5-18. The onnectivity raph igure 5-19 shows a blank body consisting of a block with two slots cut out of it and a tool body consisting of a cylinder that penetrates the block three times.

igure 5-19. The lank and Tool odies The first stage of the selective ooleans creates a non-regular unite of the two bodies and attaches cellular topology to the result (igure 5-2). In addition, the connectivity graph (igure 5-18) of the resulting cells is returned and the vertices, or cells, of the graph are marked in a way that lets one know which body or bodies they came from. igure 5-2. The lank ody fter the irst Stage of Selective ooleans raphs may be copied by calling the copy method or created for an NTITY_LIST of LLs by calling api_create_graph_from_cells. igure 5-18 is the graph that is created if the eight cells in igure 5-2 are sent to api_create_graph_from_cells. The gvertex and gedge classes also have pointers for holding true or false information as to what kind of vertex or edge they are. The meaning of kind is left to the user. vertex or edge may (or may not) be any number of kinds. or example, the cells of the body in igure 5-2 may be marked as kind (meaning being from the tool body) or kind 1 (meaning being from the blank body). Some cells may be of both kind and kind 1.

The kind method of the class generic_graph returns a subgraph of all edges and vertices of, or not of, a given kind. The graph in igure 5-18 is returned by the first stage of the selective oolean on the bodies in igure 5-19. The linear subgraph formed by the vertices (,,,,,, ) are from the tool body and marked as kind. The subgraph formed by the vertices (,,, ) are from the blank body and are marked as kind 1. The second stage of the selective oolean engine takes the non-regular united body and a list or graph of cells. It returns a regularized body that is made up of the given cells or vertices of the graph (igure 5-21). igure 5-21. The Result of Picking,, and to Keep ttaching ata to dges and Vertices *raph Theory The ++ classes of gvertex and gedge are use counted in the same way that laws are use counted. That is, they are copied by calling the add method and deleted by calling the remove method. Several graphs may refer to the same edges and vertices without having to copy the data that they may contain. To make a gvertex or gedge contain data, derive a class from the base classes of gvertex and gedge. Use a technique similar to the entity_gvertex class which enables it to contain an entity pointer. ase methods may be added to locate vertices by name or by entity, so that type casting is not necessary. method can also be added to return all the entities referenced by a graph.