Visualizing Dijkstra’s Single Source Shortest Path Dijkstra’s Algorithm can be applied to either a directed or an undirected graph to find the shortest path to each vertex from a single source. It can only be used with non-negative edge weights. A table is generated to track the distance from the source (S) vertex. The distance to each vertex is initialized to infinity except for the source itself. Another variable, π, is used to track the previous vertex from which the specified vertex was reached. Dijkstra’s algorithm starts with the source, S, and relaxes the edges that are connected directly to

# Tag: Computer Science

Exploring Shortest Paths The Bellman-Ford algorithm finds the shortest path to each vertex in the directed graph from the source vertex. Unlike Dijkstra’s algorithm, Bellman-Ford can have negative edges. To begin, all the outbound edges are recorded in a table in alphabetical order. Like Dijkstra’s algorithm, a table recording the distance to each vertex and the predecessor of each vertex is created. The distances for each vertex, except the source vertex, is initialized to infinity. Distance is represented by the variable d and the predecessor is represented by the variable π. The Bellman-Ford algorithm will iterate through each of the edges.

Visual Explanation of Johnson’s Algorithm Johnson’s algorithm finds the shortest paths between all pairs of vertices in a directed graph. It converts negative edge weights into non-negative edge links. It does this by using the Bellman-Ford algorithm to remove all negative weights. It then allows Dijkstra’s algorithm to be used on the new graph. Let’s start with an example. Since this graph contains negative edges, Dijkstra’s algorithm cannot be applied to it yet. To begin, the edge links must be transformed to contain non-negative numbers. Johnson’s algorithm starts off by selecting a source vertex. The problem with choosing an existing

Navigating Line Segments If you’re given a problem to find out whether two line-segments intersect, there is an easy approach to this. It involves finding the orientation of the line segments. If they’re different, they intersect. Each line segment has a start-point and an end-point. Our first line will be represented by (a1,b1) and our second line will be represented by (a2,b2). To test if they intersect, we need to verify the following condition: What does this mean exactly? Let’s jump into an example and find out. It’s clear to us that the two line-segments intersect, but it’s not clear

Pursuing a Computer Science Major Without Prior Experience This is the number one question that I get from those that are serious about pursuing a degree in Computer Science. It seems that they know that a Computer Science degree is not a Programming degree, even though most individuals get their CS degrees for that reason. Why? Because most Universities do not offer a Programming degree. So, do you need to know programming in order to obtain a Computer Science degree? The answer should be yes, but frequently it’s no. What is Computer Science? Computer Science is the “study of computers and computational

It doesn’t matter which degree you’re pursuing, the last thing that you want to happen is to feel like you wasted your money. How do you succeed in a Computer Science program? What is the optimal approach that you should take so that when you graduate with your B.S. in Computer Science, you’ll be ready for the workforce? I’ve gone through it and will share what worked for me when it comes to Computer Science Success. Hopefully these tips will work for you also. Proper Notes As easy as you may believe that taking notes is, it’s not as intuitive