Q:

How to find inheritance of modes?

As an example, let's use latex-mode, that inherits from tex-mode, that inherits from text-mode. Is there a command, that would take as input latex-mode and give me parent and grand-parent? Or, other way around, is there a command that would take text-mode as input, and give me children and grand-children?

A:

Property derived-mode-parent of a mode symbol gives you the parent mode it is derived from.
(get 'latex-mode 'derived-mode-parent)
(get 'tex-mode 'derived-mode-parent)

This will give you a list of the hierarchy:
(defun derived-modes (mode)
  "Return a list of the ancestor modes that MODE is derived from."
  (let ((modes   ())
        (parent  nil))
    (while (setq parent (get mode 'derived-mode-parent))
      (push parent modes)
      (setq mode parent))
    (setq modes  (nreverse modes))))

