 Okay, we've seen some lovely graphs and you're starting to get an idea what graphs are all about Very interesting type of graph that I want to show you just in this video We'll just go to Mathematica and we'll we'll have a look at the few is This one and the planar graph. Let's go to Mathematica. Let's go have a look what it's all about So here we are in Mathematica. Let's have a look at this wonderful world of planar graphs now planar graph is It's really graph that you can draw Such that you can draw the the vertices and then the edges that connect them in a plane So on a flat surface not in any kind of three dimensions on a flat surface such that the edges Do not cross each other There's no crossing of the edges. Let's have a look If I were to just make the following graph, let's go there. We'll open in a new We've got a new cell there. Let's start typing graph And we use auto complete and I'm just going to make a list here of the edges So that's one remember escape you escape undirected edge one with two Let's take one with With three so one goes to two and one also goes to three and one also goes to four Four let's make two go to three So two is an edge between two and three and Let's have an edge between two and four so two undirected edge and four and Lastly we have three and undirected edge and four Let's close our list there of all our edges and we'll save vertex labels We want the name of our vertices, please. Let's have a look at that. It's this a planar graph Well by the looks of it. It is not because we do have The two edges the edge between nodes one and three and between those two and four They do cross so is this a planar graph is it possible that this perhaps, you know that this is a planar graph and I claim that it is because I just want to draw it in a slightly different way by using the complete graph Let's say complete Graph and we're going to make the complete graph on four nodes or vertices, please Let's make the vertex labels Let's make them the name and now have a look at this because you can clearly see this is the complete graph every node Or vertex is connected to every other one, but let's have a look at this I've just redrawn it so imagine just I take this node one and I drag it Into this triangle made by two three and four. That's all we did if this if I drag this one out Between two and four Now if I do it to drag this down, I'd have exactly what I had here and just turned it a couple of degrees I'd have exactly the same but by dragging it in. I notice that this is indeed Very simply put this is a planar graph So if I look at this I might not call it a planar graph But that is just the particular way that it was drawn. I can redraw this exact same graph Look at these two. They exactly the same. I have four vertices It is a complete graph. There's edges between each one of those. There's nothing different between these two I drew them differently. The drawing of them makes no difference whatsoever And that is really when I get what I want to try and get home here is These things are abstract ideas We might see this line and we might see a little dot there, but it's not about the dots in the lines It's this concept of a node that is at the end of two edge, you know at two edges And and it's this very abstract thing in the way that you draw. It has nothing to do with it And I can show you this week. There's a function called planar graph q. So let's do planar Graph q and that says is this a planar graph now Let me show you something different about Mathematica that you haven't seen before if I were to just pass the percentage sign as a single Argument what that is going to do it is going to say what cell was executed last what piece of code was Executed last time use all of that code. So this whole line now I can go back and execute this one So let's execute this again This is now the last thing that was executed You see I did some other work in Mathematica before this recording So this was in 18 and out 18 and this now becomes in 19 and out 19 So it says that this was now executed after that this percentage sign will be the last thing that was executed That's not the thing above not necessarily it just means the last thing that was executed So it's this whole line so I can copy and paste actually this whole line Pass it as an argument. So I'm just asking is that a planar graph and it says true Even though you can clearly see the lines of cost and that's just because of the way it was drawn It has you really have to look at a way that you can manipulate a graph Just to see if it really is a planar graph and it's very difficult to prove that a graph is planar Very very difficult. It's easier to prove that it's not because you just have to find Or it's easier just to prove some way in the sub graph that there is a part that you can really not draw That that the lines to the edges do not cross So let's look at the complete graph Let's look at the complete graph in five nodes and let's make vertex labels the name and Shift enter shift return and there is a Beautiful complete graph in five nodes. Let's just ask Mathematica. Let's not worry about this and all we're gonna say planar graph Q we just going to ask it and instead of putting the percent sign. Let me show you I can just copy and paste Copy and paste this whole thing in as an argument that would be the same as the having put the percentage in and you see it's false There is no way that I can redraw this that the edges are not going to cross Okay, that can never ever be a planar graph. Let me show you something a hypercube Hypercube graph. We've never seen that one before hypercube graph. Let me just show you what it looks like before we We get to it a hypercube graph with I'm gonna say three And it doesn't mean this is not an argument to say there are only three vertices Let me show you that there are actually eight vertices here And I'm gonna say vertex labels, please give me the name. Look how beautiful Hypercube is and now I can ask you is it possible to draw this so that it is not So that it is not These edges do not cross because if I say something like this planar graph Q and The previous thing that we had executed. It's just this short-hand code. It's true It can be done and the way that it's done is let me just show you the code It's very easy to do. I'm gonna say make for me a please a planar graph. So hey Mathematica can do this for me I can say turn this that we've just had into a planar graph for me, please So let's just do this hypercube hypercube graph 3 And then let's do vertex labels again so that you can see there's no cheating going on here name We'll put in close our square braces for the hypercube graph Function close the square brackets for the planar graph Exactly the same graph these two are exactly the same the drawing of it does not make it any different Look at it. Look what is connected to what and you'll notice that it's exactly the same you can give these You know it just shifting them you can clearly draw this very same thing without any any any of these edges crossing So that is a planar graph. They are fascinating graphs and It's hard work to show to prove actually that a graph is planar It's very easy with these graphs and it's very Mathematica is very powerful the Wolfram language very powerful that we can we can ask it to to Redraw something as a planar graph if indeed it was a planar graph and it will do that for you, but to prove this if you just given a graph or With the edges and the nodes sometimes well it is Can be as we scale up very very difficult to prove this for now play around with these new functions that I've shown you Draw some wonderful graphs check whether they are planar graphs or not see if you can figure it out If you just use pen and paper or pencil and paper Enjoy planar graphs