liveBook · Manning

Edge

As explained in Grokking Data Structures

A tree link is a connection from one tree node to another tree node, typically representing a parent-child relationship.

Think of a family tree: a line from a parent to a child tells you how two people are related. In a data-structure tree, that connection is a link between nodes. If node P links to node C, P is C’s parent and C is P’s child. section 11.2

A tree’s root has no parent. Every other node has exactly one parent, so there is only one path from the root to any given node. A node with no links to children is a leaf. Some trees also store links back from children to parents to make traversal easier. section 11.2 section 11.2

Follow the links

Suppose a root has links to nodes containing 2 and 8. Those nodes are its children and are siblings, but there is no direct link between them. To travel from one sibling to the other, go through their common parent. section 11.2

A tree link is a particular kind of graph edge: graphs connect vertices with edges, and trees are connected graphs without cycles. A general graph can express relationships that do not form a parent–child hierarchy, such as social-network friendships. section 13.16 section 13.3

In a binary tree, child links are usually labeled left and right. In a binary search tree, that distinction guides where values belong: values in the left subtree are no greater than the parent’s value, while those in the right subtree are greater. section 11.20 section 11.20

How Grokking Data Structures covers it

How deep it goes
Defines links through parents, children, leaves, and unique paths, but does not implement tree links.
Examples
Illustrates a root linked to children valued 2 and 8, then contrasts friendship edges in a graph.
What it assumes
Introduces nodes, links, roots, and parent–child terminology directly.
What you can do after
Evaluate/understand it by identifying parents, children, leaves, and paths from a tree’s links.
How it connects
Relates tree links to graph edges, roots, subtrees, and binary search trees.

Also explained in

Compare how 18 books explain edge →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Data Structures. The section links point to the parts of the book it draws on.