dpje52239 2012-07-25 10:37
浏览 56
已采纳

根据一组标准匹配人[关闭]

I’m creating a facebook application which matches people people based on a set of criteria, and I figure it’s pretty easy to make a query to search the database for people matching the criteria EXACTLY, but was wondering how websites normally generate results which don’t exactly match the criteria.

I was thinking of something like a tally system where I look at the first parameter and find all the people who match that and increment a counter for their id, then look at the second and increment a counter for all the ones which match that etc. Then just display the results for the cases with the highest counters. The problem with this is that some criteria may be more important than others and I guess this could be solved with giving them a higher weighting i.e. increment counter by higher value.

So my questions are:

  1. How do websites normally do this and are there any standard php recipes for this?
  2. Is the algorithm I suggested feasible?
  3. What is this general area called? (I don't know what I should be searching google for...)
  • 写回答

1条回答 默认 最新

  • doujingke4981 2012-07-25 16:42
    关注

    I think the search term is in your question :-) I would recommend this approach:

    Treat this as a graph where each of 'N' people are connected to everyone else.
    Assign weights to the edges depending on whatever your application is.

    Then try to find the maximum matching in a bipartite graph.
    This is a well known problem. Try searching for Network flow+ bipartite graphs.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?