 So what shall we do today as far as graph theory is concerned? Let's talk about directed graphs directed So far directed Graph so far we've only looked at undirected graph and remember in Mathematica we did put the escape escape and then undirected edge and Another escape remember that now we're going to have a directed edge Now think about this let's just bring this into the real world, but remember graphs really are they are abstract things But imagine we have a road map and we represent the traffic lights at the intersections as nodes So we have this little road and there's four intersections the roads cross and the roads cross and the roads cross We might find that the road going from this traffic light to that traffic light is a one-way So you can't go driving in that direction. You can only drive in that direction So if we have an edge between those two nodes we put a little Little arrow there to indicate that this is a directed edge. It's not just an edge that connects two things Look at me. I I connect two things. No, I connected in a certain direction And this might be a one-way in this direction and this might be a one-way in that direction And this might be a one-way in this direction. So all these directed we have these directed edges Imagine a social network and we have people here. There's Sue again and Sarah and there is Let's say Andy and All these things all these people and they are friends on a social network and Sue or Sarah at least follows Sue, but Sue does not follow Sarah back So Twitter, here we go and Sarah follows Andy, but Andy follows Andy follows Sarah as well So don't worry about this notation for now. It's just a concept So don't be too concerned with what I have there and then Sue doesn't follow Sarah, but Sue does follow Andy So you can imagine this this network of people Following each other in a social network We can think about people who write the research papers together and then you know who not who's connected there We can look at traffic or the road traffic grid here. There's so many things if we have pipes that flow gas In a certain direction or water in a certain direction Sewage in another direction and another person there are so many things that you can you know They can be represented by graphs remember as I always said these are abstract objects We just use them in the real world But in short this this is what directed graphs are considered the edges have a direction to them And you can't travel back along that edge So that makes this node not in a certain way not connected to that edge Certainly in that to that this node to that node sitting not in that direction And that's going to become very important when we when we do paths and trails Through these graphs that to get from the from this node to this node might be impossible because you can't get there And if this was a one-way in this or it was a one-way in that direction both These edges end up in that node and there's no way else is no way out of that node And that's something very specific or very very important and we'll certainly certainly have a look at that in the future so here we are in Mathematica and really short and simple Just going to show you three lines of code and we're just going to create some directed graphs so By now you would think That it's quite easy to To guess at what the proper function is going to be and indeed it is directed graph so there you see I've tapped down to it and I'm going to hit tab and Tap completion directed graph and let's make some Directed edges. I'm going to do an edge list node number one. I want to go to node number two in that direction. So instead of Ue undirected edge. I'm going to say de for directed edge You can see the line of code there. You could also have typed this backslash and then inside of Square brackets the directed edge by doing escape de escape gives you that directed edge So that has to go to two. I want two to go to Three and I want three to have a directed edge back to node number one Back to node number one. I'm going to close that close and let's have a look and Beautifully you see I have my three nodes or vertices I have the edges between them, but they are now directed edges and we didn't put vertex labels here But you can well imagine node one with the edge to two two to three and three back to one I Could do the exact same thing just thinking back at a cycle graph remember the cycle graphs I'm going to say a cycle graph with three nodes, please and what I'm now going to say is directed Edges and I want that to be true So it is just going to decide it's a cycle remember cycle graph So it's going to go all the way around and I get the exact same thing that is a cycle graph with Directed edges. Let me show you one more before we get into later on in the course about the Deeper issues as far as directed graphs are concerned. Let's make a little table We're going to make a table of cycle graphs. So let's have cycle graph and Let's cycle through a couple of them Cycle through cycle graph. So I'm going to have the place all the I I'm going to say directed edges to be true And I want to show you something else else. Let's add a style To our edges edge style and I'm going to say each style arrow heads Tape down arrow heads arrow heads can take an argument the argument I'm going to give it as medium to have medium sized arrow heads So you can change the way things look here in this in this graph and that what this makes especially Makes a mathematical very powerful the way that you can manipulate the graphs and plots that you do So that is medium and then I want a plot label to each of these I want each of these cycle graphs with directed edges that I'm going to draw to have at least to have a plot label And the plot label I'm going to say it's a cycle graph and I'm going to say sub So it's either control underscore or command underscore and then I remember I was my placeholder So I'm going to close that and remember I want I let's take I going from three to six So three four five six and close so you can see what happens here on the outside. It's a table say table function here and It has this placeholder I which is not I squared or I plus two anything's this I and I is going to go from From three to six or three four five six So first time around it's going to be three It's going to draw a cycle graph with three edges directed edges is true And I'm going to have some edge style So this edge is going to have a certain style that with a medium arrowhead and Each one of these three four five and six is going to have a label And it's going to be in this format C with an underscore Let's see what this looks like and that's beautiful. So there's C3 So you see the plot label up there C sub three C sub four C sub five and C sub six And you can clearly see the nature of these directed graphs. They are cycle graphs So that's the way to do directed edges in Mathematica play around and create some interesting edges and And see how far you can how far you can get