发信人: tailang (西瓜太郎), 信区: Database
标 题: Re: How to design a database model related to six degree of se
发信站: BBS 未名空间站 (Tue Jul 31 16:33:31 2007)
If the only concern is the efficiency of these two queries, just create a
table as simple as
id1, id2, degree
where id1 and id2 are the user ids and degree is from 1 to 6
Well, insert/update/delete would be disastrous, but that's not what you are
concerned, right? (assume this is an academic project)
【 在 tennisalways (tennisforever) 的大作中提到: 】
: I am trying to design a database model related to the small world (or six
: degree of separation) phenomenon.
: With this design, I should be able to write two queries efficiently:
: a) How many degrees of separation are there between two people.
: (assuming they are connected). You may assume that you do not have to
: for more than 6 degrees.
: b) Who are all the people that have x degrees of separation from a
: given person.
: If anybody has any idea on how to do this, or any references, please let
※ 来源:·WWW 未名空间站 海外: mitbbs.com 中国: mitbbs.cn·[FROM: 216.113.]