2
我想根據喜歡,評論,轉貼接收次數和時間爲社交網絡開發簡單的排名算法。我一直在閱讀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
沒有任何人有一個更好的解決方案?
你的算法有什麼問題?公式結構看起來合理,你有參數問題嗎? – Mathias