3.5.13 · D1Graphs

Foundations — A - algorithm — heuristic, admissibility, consistency — important for GNC

2,434 words11 min readBack to topic

Before you can read the parent note (A* topic) you must own a small pile of symbols. This page builds each one from nothing, in an order where every new idea only leans on ones already defined.


0. What is a graph, really?

Everything here lives on a graph. Before any formula, picture it.

Figure — A -  algorithm — heuristic, admissibility, consistency — important for GNC

In the figure the dots are nodes, the lines are edges, the number written on each line is its weight , and the entire drawing together is the graph. A path is just a chain of edges you walk one after another; its total cost is the sum of the weights you stepped on. This is the raw stage on which A* plays.


1. The cost symbol

Picture: a single arrow from dot to dot with a price tag hanging off it. That price tag is . We need this symbol because every later quantity — , , the whole triangle inequality — is built by adding up these edge prices.


2. The start node and the goal node

Two nodes are special. Everything A* does is measured relative to them, so they deserve their own symbols.

Picture two dots circled specially in the graph: one labelled where you plant your flag to begin, one labelled where the treasure sits. Every cost below is either "distance from " or "distance to ".


3. — the cost already paid

Now we chain edges together and add the tags.

Figure — A -  algorithm — heuristic, admissibility, consistency — important for GNC

In the figure, the red path from to node is the route we walked; is the sum of the numbers along that red path. Look how it is entirely behind us only ever measures road we have already travelled.


4. and — the guess and the truth about what's left

looks backward toward . To aim at we need something that looks forward.

Figure — A -  algorithm — heuristic, admissibility, consistency — important for GNC

In the figure the dashed red arrow is the guess — a straight peek from toward . The wiggly black line is the true cheapest remaining road we'd actually have to walk. Notice the dashed guess is shorter or equal — that's the whole game, and it has a name (Section 6).


5. — the total-trip score

Figure — A -  algorithm — heuristic, admissibility, consistency — important for GNC

The figure stitches the two halves: solid red = (behind us, back to ), dashed red = (guess ahead, toward ). Their sum, the full red span from to through , is .


6. Admissible — the "never overpromise" rule

Now we can state the single condition that makes A* trustworthy.

Picture Section 4's figure again: the dashed guess sitting at or below the true wiggly path. That "at or below" is admissibility. It matters because if a guess ever overpromised ("goal is far!") on a genuinely-good node, A* might skip that good node and return a worse path — the failure shown in the parent's Worked Example 2.


7. Consistency — the "smooth, no-dips" rule

Admissibility talks about each node alone. Consistency talks about neighbours.

Consistency is stronger than admissibility: the parent proves consistent ⟹ admissible (arrow one-way: C → A). Its payoff is that the score never dips as you go deeper, which lets A* close a node once and never reopen it.


8. The open list & the Priority Queue

A* has to keep asking "which node has the smallest ?" thousands of times. That question needs the right container.

Picture a bucket that automatically floats the cheapest- node to the top; you always scoop from the top. Without it, finding the min every step would be slow and A* would lose its speed advantage.


How these feed the topic

graph of nodes and edges

edge cost c(u,v)

start s and goal t

g(n) cost already paid

h star true remaining cost

heuristic guess h(n)

f = g + h score

admissible h below h star

consistent triangle inequality

A star expands smallest f

priority queue min heap

Read it bottom-up: the graph plus a start and goal give costs; costs build ; a chosen guess builds ; together they build ; the two honesty rules (admissible, consistent) keep trustworthy; the min-heap makes "pick smallest " fast — and that is A*.


Equipment checklist

Cover the right side; can you say each before revealing?

  • A graph is ::: a collection of nodes together with the edges joining them — the whole picture.
  • A node and an edge are ::: a place (dot) and a travel-connection (line/arrow) between two places.
  • Directed vs. undirected means ::: a directed edge goes one way only; an undirected line means both and exist with equal cost.
  • means ::: the cost/weight on the directed edge from node to node (not assumed equal to ).
  • and are ::: the start node where the search begins and the goal node it tries to reach.
  • is ::: the total cost of the best-known path from to ; base case and initially for all others.
  • is ::: the true cheapest remaining cost from to the goal .
  • is ::: an estimated (guessed) cost from to , approximating from a chosen formula.
  • equals ::: , the estimated total cost of a whole -to- trip through .
  • Admissible means ::: — the guess never overestimates.
  • Consistent means ::: with — the triangle inequality for the guess.
  • Consistent implies ::: admissible (one-way: C → A), and additionally means never dips, so no node is re-expanded.
  • The open list is ::: the frontier of discovered-but-not-yet-expanded nodes.
  • A priority queue / min-heap gives you ::: the smallest- node quickly, so A* can pop the best candidate each step.