Let we have a forest $F_n(P)$ with $n$ nodes defined by set $P$ of all pairs $\{\text{father}, \text{son}\}$. For instance $P=\{\{1, 2\}, \{3, 4 \}, \{1, 3 \}\}$ defines a forest $F_5(P).$
Let $k_i$ is the number of descendants the node $i$. For the forest $F_5$ we have $k_1=3, k_2=0, k_3=1,k_4=0.$
Let $K_n(P)$ be the number of all triplets $\{i,j,k\}$ such that no one of the pairs $\{i,j\}$, $\{i,k\}$, $\{j,k\}$ belong to $F_n.$ For example, for the forest(tree) $F_5(P)$ defined abowe there are 3 such triplets: $$ \left\{ \{1,4,5\},\{2,3,5\},\{2,4,5\} \right\}. $$
Question Is it possyble to express $K_n(P)$ in terms of $k_1, k_2, \ldots, k_n?$ If no, then what a set of parameters of $P$ we should to calculate to find $K_n(P)$?
For any $P$ I can find $K_n(P)$ by brute forse algorithm but I am interesting in exact combinatorial formula. Thanks.
The answer is no. Your $k_i$ parameters are not enough to reconstruct the graph, and not enough to count triangles in the complementary graph (which is what $K_n$ represents).
For example, consider $P=\{\{1,2\},\{2,5\}\}$ and $Q=\{\{1,3\},\{1,4\},\{2,5\}\}$. They have the same $k_i$ parameters, namely $2,1,0,0,0$. However the first one has five triangles in the complementary graph (so $K_4=5$), while the second has only two.