52
Decision Maths Graphs/Networks

D1,L4 Graphs and Networks.ppt

Embed Size (px)

Citation preview

  • Decision Maths Graphs/Networks

  • GraphsA graph is just a diagram made up of dots and lines. These are all graphs.

    The dots are called nodes or vertices (singular is vertex)The lines are called edges or arcs

  • Definitions 1 An edge with the same vertex at each end is called a loop.

    The degree or order of a vertex is the number of edges incident on it.Question For any graph the total of the orders of its verticies is even, why? A simple graph is one in which there are no loops, and in which there is no more than one edge connecting any pair of vertices.

  • Definitions 2A walk is a sequence of edges in which the end of one edge (except the last) is the beginning of the next.

    A trail is a walk in which no edge is repeated.

  • Definitions 3A path is a trail in which no vertex is repeated.

    A graph is connected if there exists a path between every pair of vertices.

  • Definitions 4A cycle is a closed path if the end of the last edge is the start of the first.

    A Hamiltonian cycle is a cycle which visits every vertex once and only once.

  • Definitions 5A tree is a simple connected graph with no cycles.

    A tree Not trees

  • Definitions 6A Digraph (Directed Graph) is a graph in which at least one edge has a direction associated with it.

    A complete graph is a simple graph in which every pair of vertices is connected by an edge.

  • Definitions 7An incidence matrix is a way of representing the number of edges between nodes in a matrix. The graph below is represented by the matrix next to it.

  • Definitions 8Two graphs are Isomorphic if one can be stretched, twisted or otherwise distorted into the other.Which two graphs below are Isomorphic?

    If two graphs are isomorphic then the labels on them must correspond to each other.

  • Definitions 9A planar graph is one which can be drawn without any edges crossing. Which graph(s) below is Planar?

    Draw two examples of Planar graphs.

  • Definitions 10A bipartite graph is one in which the vertices fall into two sets and in which each edge has a vertex from one set at one end and from the other set at its other end.

  • Question 1X = { London, Oxford, Birmingham, Cambridge, Leicester}Let X x X be the set of all possible pairs from the set X.(there exists a road between the two towns)X x X = { (London, Oxford)(London, Birmingham)(London, Cambridge)(London, Leicester)(Oxford, London)(Oxford, Birmingham)(Birmingham, London)(Birmingham, Oxford) (Birmingham, Leicester)(Cambridge, London)(Leicester, London)(Leicester, Birmingham) }Draw a graph to show the set X x X.

  • Question 1

  • Question 2Each node represents a section of land.

    And each arc is the route over the bridges.

  • EulerianA graph is called Eulerian or traversable if each can be traced once and only once, without lifting pencil from paper.A graph is traversable if it has no odd vertices or just two odd vertices.Prove that the graph below is traversable.

  • NetworksA Network is a weighted graph, which just means there is a number associated with each edge.

    The numbers can represent distances, costs, times in real world applications.Obvious examples include maps and similar geographical networks.

  • Networks

  • The Minimum Connector ProblemBasically you need to travel to every node using the least total length.Consider 4 houses in a Network shown in the diagram below. The weight on each arc represents the distance between each house.An Electricity company wants to supply every house by using as little cable as possible.

    Clearly the shortest possible route is to go from A to B to C and then to D.So 4 + 3 + 3 = 10, there is no shorter way of supplying every house.

  • Algorithm`sThe previous example was a simple one and the solution was very easy to spot.For more complicated examples you will need to use an algorithm.An Algorithm is simply a list of instructions that solve a particular problem. (You will cover Algorithms in more depth later on in the course)

  • Kruskal`s AlgorithmThere are 3 steps to follow in Kruskal`s Algorithm.Step 1 Select the shortest arc in the network.Step 2 Select the shortest arc from those which are remaining. Ensure that you do not create a cycle. If you do ignore and move on to the next shortest arc.Step 3 If all the vertices are connected then stop. If not return to step 2.

  • ExampleConsider the Network below.It helps to rank the arcs in increasing order.

  • Applying the Algorithm1 Start by selecting the smallest arc, AB or DE, it makes no difference.Select AB.

  • Applying the Algorithm2 Now select the next smallest, which is DE.

  • Applying The Algorithm3 Next we can select CF or DF, again it makes no difference. Lets pick DF.

  • Applying the AlgorithmNext select CF.

  • Applying the AlgorithmThe next smallest length is EF. However there is already a route from E to F, so this arc is not required.

  • Applying the AlgorithmAdding CD will again create a loop so the last arc to add is AF. All vertices are now joined so the problem is complete.

  • Question Ex 3a pg 66 q1Find the minimal spanning tree and associated shortest distance for the network below:

  • Solution Ex 3a pg 66 q1

  • Solution Ex 3a pg 66 q1

  • Solution Ex 3a pg 66 q1

  • Solution Ex 3a pg 66 q1

  • Solution Ex 3a pg 66 q1

  • Solution Ex 3a pg 66 q1

  • Solution Ex 3a pg 66 q1

  • Solution Ex 3a pg 66 q4

  • Solution Ex 3a pg 66 q4

  • Solution Ex 3a pg 66 q4

  • Solution Ex 3a pg 66 q4

  • Solution Ex 3a pg 66 q4

  • Solution Ex 3a pg 66 q4

  • Solution Ex 3a pg 66 q4

  • Solution Ex 3a pg 66 q4

  • Solution Ex 3a pg 66 q4

  • Solution Ex 3a pg 66 q4

  • Solution Ex 3a pg 66 q4

  • Solution Ex 3a pg 66 q4

  • Solution Ex 3a pg 66 q4

  • Solution Ex 3a pg 66 q4

  • Solution Ex 3a pg 66 q4

  • Solution Ex 3a pg 66 q4