The enumeration of graphs with a certain specified structure
is one of the classical problems in graph theory,
and has a variety of applications
including the enumeration of chemical compounds.
When we enumerate``labeled'' graphs, two ``labeled'' graphs are
allowed to be isomorphic, i.e.,
they are the same ``unlabeled'' graph where labels on vertices are ignored.
Contrary to this, enumerating ``unlabeled'' graphs means that no two
generated graphs are allowed to be isomorphic.
Most efficient algorithms for enumerating labeled graphs or
unlabeled graphs have been designed based on the branch method,
which usually uses a polynomial space and generates
a graph one after another obeying a fixed but unseen order of graphs.
Dynamic programming is another algorithm design technique based on
which a given problem is decomposed into subproblems
in a different way from the branch method.
In this paper, we study how to design enumeration algorithms based on
dynamic programming, taking the problem of enumerating
``unlabeled'' rooted trees as the first target of this object.
The ranking problem asks us to identify the rank k
of a given rooted tree in a certain specified total order
over all trees.
Contrary to this, the unranking problem is the inverse
of the ranking problem, which, given integers n and k,
asks us to construct the k-th rooted tree with n vertices
over a specified total order on all trees.
We introduce a total order over all ``unlabeled'' rooted trees
so that we can design both ranking and unranking algorithms
based on dynamic programming.
Each of our ranking and unranking algorithms runs in polynomial
time of n, which is independent of the number of all rooted trees
with n vertices.
In order to design an enumeration/ranking/unranking algorithm,
we use a mapping from ordered trees to sequences and a mapping
from rooted trees to ordered trees.
By these two mappings, rooted trees can be represented as sequences.
We define a total order over all rooted trees to be
the lexicographical ascending order
over the corresponding sequences.
Based on this total order over rooted trees, we show that
every rooted tree can be represented as
a sequence that consists of the number of vertices and
the rank of subtrees connected to the root.
From the observation, we treat the ranking/unranking problems
as problems on certain types of sequences.