It's kind of like that. But we'll use the usual computer science method to describe it in the language of binary relationships.

You are probably already familiar with binary relationships such as equality $ = $, less than or equal to $ le $subset $ subseteq $, and so on. Generally a binary relationship $ R $ about a sentence $ X $ is a subset $ R subseteq X times X $, If $ (x, y) in R $we call this as $ xRy $,

If $ forall x in X, xRx $, then $ R $ is *reflexive*, The relationships $ = $ and $ le $ are reflexive, however $ lt $ is not.

If $ for all x, y, z in X, xRy , Wedge , yRz Rightarrow xRz $, then $ R $ is *transitive*, Many relationships are transitive, including all of the above. If $ x le y $ and $ y le z $, then $ x le z $,

Given a relationship $ R $, the *reflexive transitive closure* of $ R $designated $ R ^ * $is the smallest relationship $ R ^ * $ so that $ R subseteq R ^ * $, and $ R ^ * $ is reflexive and transitive.

Interpret your graph as a binary relationship (since the edges don't seem to really matter to you, you're only interested in the amount of vertices). That's exactly what you want: $ xR ^ * y $ then and only if $ y $ is a "descendant" of your meaning $ x $,

If you look at the literature, you need to know another notation: the *Transitive closure* of $ R $designated $ R ^ + $is the smallest relationship $ R ^ + $ so that $ R subseteq R ^ + $, and $ R ^ + $ is transitive. Algorithms for calculating the transitive closure and the reflective transitive closure are related because they differ only in the "diagonal" entries: $ R ^ + cup left {(x, x) , | , x in X right } = R ^ * $,

There are several standard algorithms for calculating the RTC of a relationship. If the relationship is tight in the sense that it is feasible to represent it as a bit matrix, the Floyd-Warshall algorithm is one of the fastest practical algorithms; its term is $ Theta (| V | ^ 3) $ In theory, however, the inner loop on real hardware is quite fast because it involves a series of bit vector manipulations.

For sparse relationships, see Esko Nuutila's thesis, which contains a very good overview and some newer algorithms.