 Imagine starting at any vertex. You can use an edge to go to another vertex. From there, you can use another edge to go to another vertex, and so on. This gives you a walk, an alternating sequence of vertices and edges, where each edge is incident on the vertex before and after it. The initial vertex is v0, the end vertex is vk, and the walk has length k. Now in general, we'd want to specify both the vertices and the edges our walk passes through. But in a simple graph, there is a unique edge between two vertices, so we can simply specify the vertices we pass through. So for example, let's draw a simple graph, then walk this way. So let's go ahead and use our walk to define our graph. The walk begins at vertex 1, it passes along an edge to vertex 4, then along another edge to vertex 3, then along another edge to vertex 2, then to vertex 4, and we want to get back to vertex 1. Since the graph is a simple graph, and there's already a vertex joining 1 and 4, the walk reuses this edge. Now remember, definitions are the whole of mathematics, all else is commentary, and if it's not forbidden, go ahead and do it if it pleases you. So nothing in the definition of a walk prevents you from reusing an edge, revisiting a vertex, or returning to your starting point. But you can prohibit these. A trail has no reused edges, a path has no revisited vertices, and a cycle begins where it ends without revisiting intermediate vertices. For example, let's consider a graph. If possible, let's find a walk that is not a path or a trail, a walk that is a path but not a trail, a walk that is a trail but not a path, and a cycle. A walk that is not a trail would have a repeated edge, and if it's not a path it would also have a repeated vertex. So we just have to make sure we reuse an edge and a vertex. For example, 1 to 2 to 4, back to 2 would reuse the edge and repeat a vertex. A walk that's a path has no repeated vertices, but if it's not a trail we reuse an edge. However, in order to reuse an edge we have to revisit the vertices. So it's not actually possible to find a path that is not a trail. A walk that's a trail has no repeated edges. If it's not a path then it has a revisited vertex. So we just need to make sure we get back to a vertex using a different route. So we could walk from 1 to 2 to 4 to 3, back to 2, and that revisits a vertex without reusing any edges. And the cycle gets us back to our starting point without revisiting any vertices. And so we might go from 1 to 2 to 3 to 5, back to 1. Now that we know about navigating around graphs, let's talk about connections. A graph is connected if there is a path between any two vertices. For example, there's no path between vertices 4 and 7, and so the graph shown is not connected. How about distance? The distance between vertices v1 and v2 is the length of the shortest path between them. If no such path exists, the distance is considered infinite. If one or more shortest paths exist, they're called geodesics. So for example, let's try to find the distance between 1 and 8. And that means we want to find the shortest path from 1 to 8. Now rather than trying to navigate from 1 to 8 and then finding the shortest path, it's worth noting that sometimes making a problem harder makes it easier. And so rather than trying to find the shortest path from 1 to 8, let's expand from 1 to find all distances from 1 to another vertex. This method is known as Dijkstra's algorithm after the Dutch computer scientist Edske Dijkstra. So if we expand from 1, there's two vertices, 2 and 5, that are at distance 1, expand out a little further, and there's two vertices, 3 and 4, that are at distance 2, expand out a little further, there's two vertices, 7 and 8, that are at distance 3, and then finally there's one vertex at distance 4. And so the distance between 1 and 8 is 3. And incidentally, we've found the distances between 1 and any other vertex, and we've also found a geodesic.