Skip to content

ahmed-nabil-elagder/trees-graphs-visualization

Repository files navigation

trees-graphs-visualization

Its a reference to visualize some of core concepts of Trees and Graphs data structures

Normal Tree vs Programming Tree - visualization

Difference between (Node Depth) and (Node High) - visualization

The Depth of a node
	1. Is the number of edges from the node to the tree's root node
	2. Root node will have a Depth of 0
The Height of a node
	1. Is the number of edges on the longest path from the node to a leaf
	2. Leaf node(s) will have a Height of 0

Graph data structure representation - visualization

In terms of programming, there are two common ways to represent a graph.
	1. By Adjacency List
	2. By Adjacency Matrix

Trees Traversals - visualization

PreOrderTravesal
	1. [[ traverse current node ]]
	2. traverse left tree
	3. traverse right tree
InOrderTravesal
	1. traverse left tree
	2. [[ traverse current node ]]
	3. traverse right tree
PostOrderTravesal
	1. traverse left tree
	2. traverse right tree
	3. [[ traverse current node ]]

Graph Search - visualization

For simplicity, we will visualize over Trees as Trees are special subtype of Graghs
Trees are already Graphs but without CYCLES

DFS (Depth First Search)
	1. [[ traverse current node ]]
	2. [[ mark current node as visited ]]
	3. For Each NON-Visited neighbors 
		=> visit it (Recursion)
		Note: DFS can be also implemented by Stack (Iterative)
BFS (Breadth First Search)
	1.  Enqueue root node into a Queue
	2.  While Queue is not empty => (Iterative)
		2.1 Dequeue Queue - current node
		2.2 [[ traverse current node ]]
		2.3 [[ mark current node as visited ]]
		2.4 For Each NON-Visited neighbors 
			=> Enqueue into Queue

Releases

No releases published

Packages

No packages published