If it’s a material expression there’s kind of no way to tell is there?
It could be a function that’s 5000 nodes long or 1 node. So solving it backwards recursively while possible is a nightmare.
What about just testing R G and B separately for values?
Usually when making materials the editor puts 0 in pins that aren’t connected.
So in the event that only one channel is used for Diffuse, the reading of R G and B would contain different parameters ?