我正在尝试根据喜欢、评论和转发接收的数量和时间为社交网络开发一个简单的排名算法。我一直在阅读有关 facebook 使用的边缘排名算法并尝试做类似的事情,但我无法做到正确。
该算法现在应该显示热门帖子。
这是我尝试过的:
let nComments = (from c in db.Comments where c.postid == r.pageOwner.PostId select c).Count()
let nReposts = (from s in db.Posts where s.RepostedFrom_postid == r.pageOwner.PostId select s).Count()
let nLikes = (from u in db.UserPageRelations where u.Post_id == r.pageOwner.PostId select u).Sum(s => s.Rate)
let TimeDecayFactor = ignoretime ? 1 : Math.Exp(-(DateTime.Now - Post.Date).TotalHours)
let TotalEdge = (1 * nComments + 3 * nLikes + 2 * nReposts + 1) * TimeDecayFactor
orderby (TotalEdge) descending
有没有人有更好的解决方案?