Taking huge time to count node which has multiple edge with same specific node?

here I one of your solution is similar to me

here in your problem NEXT relationship is directed to multiple times in some specific node from other node . that specific node is my d node and others nodes are my C nodes, I wanted to count C nodes