In my experience I have found three main pathfinding problems

Graph - a set of nodes and paths are already given. Very easy to solve using a depth first search algorithm.

code formulation:
given an adjacency list, the depth first search follows a path from the start until it can not go any further. It stops because it reaches a node it has visited before or it reaches the destination. You then back up the path to the last decision and follow a new path as far as it goes. You keep track of the total distance travelled until all nodes have been traversed. This algorithm can be modified for easy AI giving the process only a certain amount of time to find a path. Once a time limit is hit you take the best path found in that time.


Vector - You have a region to traverse in which walls represented as vectors(start point, and end point) You are allowed to go anywhere without crossing walls. ie you are not limited to tiles.

code formulation:
You would first create an adjacency list (on the fly for AI) This is done by taking your starting point as node 1. The next node will be a corner of a wall that you can go around. (ie your position does not fall within the anlge made by two joining walls) It also helps to extand the node along the line travelled to get past the edgeof the wall. You then repeat the process until you have found the destination or all nodes have been traversed.

Gradient - moving in certain directions has a cost related to the distance traveled. This is commly used in terrain traversal.

code formulation:
Draw a straight line between taget and destination. Calculate total time to traverse line. Break the line in a number of sub lines. At each point move the line in the negative direction of the gradient. At the new point. Calculate the new distance from the two node you did not move. If it increased or did not change move the node back and move another node. This will not ensure the fastest route but can significanly cut down the time.

I dont have any code for the above at the moment. I will be trying to write code for each over the next month. If I finish anything that is reasonable you'll be sure to see a post.