I have a directed graph (grafopri1fase1
) the graph has no loops and it has a tree structure (not binary tree).
I have an array of nodes (meterdiretti
) that i have extracted from the graph (grafopri1fase1
) matching a condition.
I would like to know starting from each node of Meterdiretti
how many nodes are under each node of Meterdiretti
.
The result I would like to have is a Matrix with the following format
first column------------ second column
meterdiretti[1] -------- total amount of nodes reachable starting from meterdiretti[1]
meterdiretti[2] -------- total amount of nodes reachable starting from meterdiretti[2]
....
meterdiretti[n] ----------total amount of nodes reachable starting from meterdiretti[n]