more updated content to display on the new site
This commit is contained in:
@@ -1,38 +1,35 @@
|
||||
# Adjacency list
|
||||
A\* Pathfinding
|
||||
===============
|
||||
|
||||
Imagine 8 nodes with no connections
|
||||
There are 3 main values usedd in reference to A\*:
|
||||
|
||||
To store this data in an _adjacency list_ we need __n__ items to store them.
|
||||
We'll have 0 __e__dges however so in total our space is (n+e) == (n)
|
||||
f = how promisiing a new location is
|
||||
g = distance from origin
|
||||
h = estimate distance to goal
|
||||
f = g + h
|
||||
|
||||
# Adjacency matrix
|
||||
For a grid space our `h` is calculated by two straight shots to the goal
|
||||
from the current location(ignore barriers). The grid space `g` value is
|
||||
basiccally the number of steps we've taken from the origin. We maintain
|
||||
a list of potential nodes only, so if one of the seeking nodes gets us
|
||||
stuck we can freely remove that, because it succs.
|
||||
|
||||
space: O(n^2)
|
||||
The convention for notation btw is [x,y] meaning:
|
||||
* _from x to y_
|
||||
Time & Space Commplexities
|
||||
==========================
|
||||
|
||||
# Breadth first search
|
||||
Best-First Search
|
||||
-----------------
|
||||
|
||||
add neighbors of current to queue
|
||||
go through current's neighbors and add their neighbors to queue
|
||||
add neighbor's neighbors
|
||||
keep going until there are no more neighbors to add
|
||||
go through queue and start popping members out of the queue
|
||||
Time: O(VlogV + E)
|
||||
|
||||
# Depth first search
|
||||
Dijkstra's
|
||||
----------
|
||||
|
||||
Here we're going deeper into the neighbors
|
||||
O(V\^2 + E)
|
||||
|
||||
_once we have a starting point_
|
||||
A\*
|
||||
---
|
||||
|
||||
_available just means that node has a non-visited neighbor_
|
||||
if available go to a neighbor
|
||||
if no neighbors available visit
|
||||
goto 1
|
||||
Worst case is the same as Dijkstra's time
|
||||
|
||||
# Kahn Sort
|
||||
|
||||
|
||||
# Graph Coloring
|
||||
|
||||
When figuring out how many colors we need for the graph, we should note the degree of the graph
|
||||
O(V\^2 + E)
|
||||
|
||||
Reference in New Issue
Block a user