我将尝试开发一种简单的排名算法,基于社交网络上帖子获得的点赞数、评论数、转发数和时间。我已经阅读了Facebook使用的Edge Rank算法,并尝试做类似的事情,但我无法做到完美。
该算法应该显示当前热门帖子。
以下是我的尝试:
该算法应该显示当前热门帖子。
以下是我的尝试:
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
有没有更好的解决方案?