# Graph Journey

To search in a graph (path of Graphs), we first build a tree covering the graph.

Contenus

## Breadth-first search / Deep search

BFS traverses the tree increasing the depth to the root.

```BFS(Graph G, Node s): {f = CreateQueue (); f.stack (s); mark (s);
while no f.empty () s = f.pop (); print (s);
for each children t of s in G
yew t unmarked DO f.stack (t); mark (t);
end if
end for
end while
}```

## In-depth search: pre-order

In-depth algorithms are recursive. In the prefix path, we always traverse the left subtree before processing the right subtree.

1. Check if the current node is empty or null.
2. Displays the data portion of the root (or current node).
3. Traverse the left subtree by recursively calling the preorder function.
4. Traverse the right subtree by recursively calling the preorder function.

## In-depth search: in-order

The LNR traverses as far left as possible, and displays branches from left to right. This algorithm displays diagonals from bottom to top.

1. Check if the current node is empty or null.
2. Traverse the left subtree by recursively calling the in-order function.
3. Displays the data portion of the root (or current node).
4. Traverse the right subtree by recursively calling the in-order function.

## In-depth search: out-order

It is a diagonal navigation from top to bottom.

1. Check if the current node is empty or null.
2. Traverse the left subtree by recursively calling the post-order function.
3. Traverse the right subtree by recursively calling the post-order function.
4. Displays the data portion of the root (or current node). FR FR EN ES