Dijkstras n stuf

10 flashcardsby Sabs2023
Study these flashcardsFree · spaced repetition · iPhone, Android, Mac & web

All cards

1
Dijkstras algorithm?
Finds shortest path between one node and all other nodes on a weighted graph
Type of breadth first search
2
Uses of dikjstras?
GPS Navigation
Robots/Game Path finding
3
How to do dikjstras algorithm?
1)Create table with columns node,distance from start,visited,previous node.
2) Set initial distances from start (0 for A and infinite for rest) for all nodes
-For all nodes
3)Find node with shortest distance from start that hasnt been visited
4)For all connected nodes, calculate distance from start
4i) IF value is smaller than current one distance update it and set previous node to the current one(the one at 3rd step)
5)Mark that node(3rd step) as visited
4
Outputting shortest path?
1)Start at the node WE want to reach
2)Follow the previous nodes and add it to the start of list.
To this until you reach the start
5
Do this T TO S
Shortest path way to S is T->C->S
C =9
S =23
T=0
6
A* pathfinding algorithm?
Finds shortest path between 2 NODES on a weighted graph using heuristics
7
A* uses?
Network packet routing
Solving puzzles
Social networking analysis
8
how to do a* A TO L
1) Create table with columns node,visited,distance from start(g),heuristic(h), f (g+h) and previous node
2)Set inital distance and f to infinite(or leave blank)
-For all nodes
3)Find node with lowest f value not visited
4)FOR EACH CONNECTED NODE
4i) Calculate distance from start(g) by adding edge value and distant from start then add heuristic value for F value
4ii)IF f value calculated is lower than current one update it and set previous node to the current node(one at step 3)
DO THIS UNTIL GOAL NODE(L HERE) IS VISITED
9
Outputting shortest path a*?
Same as dijkstras
10
Heuristic?
Designed to solve a problem faster when classic methods are too slow and makes an educated guess
"Good enough"
Study all 10 cards for free