Graphs and Trees Flashcards
Self loop
Edge leading to and from the same node
Degree
Number of edges leading to or from a node
When counting the degree of a node, self loops should be counted…
Twice
Path
Edges that can be used to reach a node
Length of a path
k - 1 (k being the number of nodes)
Circuit
A path where the start and end nodes are the same
Cycle
A circuit where you don’t visit the same node (except the start/end node) twice
Hamiltonian
A circuit including all nodes
Root node
No edges pointing towards it
True or false: A leaf node has both in and outgoing edges
False! A leaf node has no outgoing edges.
Depth
Number of edges to a node from the root
True or false: The number of nodes in a tree is exponential to its depth
True!
Binary tree
A tree with no more than 2 subtrees per node
In a binary tree, there are no more than _ nodes at any level
2 to the power of L (L being the current level)
True or false: There are multiple ways to reach each node in a tree
False! Each node has a unique path leading to it.