which part do you want open sourced? timelines are generated after going through machine learning and then multiple services. even then, some of the infrastructure limits what you see in the end.
https://blog.twitter.com/engineering/en_us/topics/infrastruc...
> Unfortunately, Haplo has its limits. Since we try to pull every single Tweet ID in a conversation every time a conversation is loaded in real-time, this is potentially an unbounded amount of data. We’ve found that if our platform tries to load more than a certain number of entries from our cache at once, our cache request latency will spike, and we begin to time-out on a significant fraction of read requests. Because of this, there is a limit of thousands of Tweets per conversation tree in this cache.
even just showing an ad is a ton work has a bunch of services involved
https://blog.twitter.com/engineering/en_us/topics/infrastruc...
Other stuff that I think explains the complexity
https://blog.twitter.com/engineering/en_us/topics/insights/2...
https://blog.twitter.com/engineering/en_us/topics/insights/2...
https://blog.twitter.com/engineering/en_us/topics/insights/2...
there's no single algorithm, its a bunch of parts coming together from hundreds of engineers and multiple services.