To me it seems that the only thing Tor is doing for anonymity (not security!) is the fact that it does not record the traffic in and out, because obviously if every router was recording the traffic going through it (let alone publish that information), every pathway would be clearly visible and then anyone could backtrace anyone.
But how does Tor guarantee that nodes do not log their traffic and/or send them to an adversary? I would bet that all NSA-helded routers would keep track of this and I bet that most of private-held routers would also do this since Tor is open-source and since people are naturally driven for evil.
Anonymity would still work if the nodes did not cooperate with each other (sharing traffic logs) or if the data passed through one honest node that does not log any information, but it's still a major flaw if most of the network you don't know if you can trust.
So how does the Tor network know whether to trust a node not to send traffic information to an adversary or to make it publically available?