Breadth-First Search
Breadth-first Search (BFS) is an algorithm used to explore the vertexes of a graph layer by layer. It starts at the given vertex and explores all vertices at the present depth prior to moving on to the vertices at the next depth level.
Specifications
CREATE QUERY tg_bfs(SET<STRING> v_type, SET<STRING> e_type,INT max_hops=10, VERTEX v_start, BOOL print_accum = True, STRING result_attr = "", STRING file_path = "", BOOL display_edges = True)
Characteristic | Value |
---|---|
Result |
Returns all the nodes that are accessible from the source vertex |
Required Input Parameters |
|
Result Size |
V = number of vertices |
Time Complexity |
O(E+V), E = number of edges, V = number of vertices.since every vertex and every edge will be explored in the worst case. |
Graph Types |
Directed or Undirected edges, Weighted or Unweighted edges |