Since A and C are connected via B, omitting it would be a misrepresentation of your graph. I can see how in some very specific use-cases, like yours, it might seem desirable, but IMO it would undermine the usefulness and the very meaning of the representation.
I would suggest, instead, that you tried to make those unwanted nodes less visually prominent by assigning them the background color (using groups and a path: filter).
Again, even if this sounds attractive right now, that would be like a game of Six Degrees of Kevin Bacon without all the actors in the middle: they are all potentially linked to him, and the fun part is to see how.