Breadth-first Search Flashcards
What is graph?
A graph models a set of connections
Graphs are made up of nodes and edges. A node can be directly connected to many other nodes. Those nodes are called its neighbors.
What is breadth-first algorithm?
It’s a graph search algorithm
What is queue?
It’s a data structure that store items, have two action: enqueue and dequeue, it’s use the first in first out technique.
What is the breadth first algorithm running time ?
Adding to queue => o(1)
Search => O(V+E) (V for number of vertices, E for number of edges).
What is topological sort?
If task A depends on task B, task A shows up later in the list. This is called a topological sort, and it’s a way to make an ordered list out of a graph.
What is tree?
is a special type of graph, where no edges ever point back.
What is the difference between direct and undirect graph?
• A directed graph has arrows, and the relationship follows the direction of the arrow.
• Undirected graphs don’t have arrows, and the relationship goes both ways.