由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - How to design a database model related to six degree of separation?
相关主题
职业杯上一个DATABASE题目。 (转载)关于DATABASE 的研究方向
如果想学深学透SQL是否应该去学校一个关于 通过Matlab databast toolbox 获得MySQL数据的问题,两个机器,谢谢!
A sql question吐血了
MSSQL 怎么解决内存是释放的问题?请帮我看看,什么地方错了?
mySQL怎么这么慢?问一个转行到数据库方面的事,急求大家建议!
java database access problem!!!问个SQL的问题
如果publish一个access database on the web?Is Netezza really good?
How to improve performance of Database?现在转行学数据库有前途吗?
相关话题的讨论汇总
话题: separation话题: degrees话题: degree话题: design话题: six
进入Database版参与讨论
1 (共1页)
t**********s
发帖数: 930
1
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 check
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, pleas
t*****g
发帖数: 1275
2
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)

check
me

【在 t**********s 的大作中提到】
: 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 check
: 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, pleas

t**********s
发帖数: 930
3
Well, I am supposed to create a series of tables to hold a person and all
their friends.
Besides, how can I write the two queries to:
a) How many degrees of separation are there between two people. (
assuming they are connected). You may assume that you do not have to check
for more than 6 degrees.
b) Who are all the people that have x degrees of separation from a
given person.

are

【在 t*****g 的大作中提到】
: 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)
:
: check
: me

1 (共1页)
进入Database版参与讨论
相关主题
现在转行学数据库有前途吗?mySQL怎么这么慢?
data analyst in HR departmentjava database access problem!!!
DBA主要是做优化还是维护如果publish一个access database on the web?
请教高手关于database query的问题How to improve performance of Database?
职业杯上一个DATABASE题目。 (转载)关于DATABASE 的研究方向
如果想学深学透SQL是否应该去学校一个关于 通过Matlab databast toolbox 获得MySQL数据的问题,两个机器,谢谢!
A sql question吐血了
MSSQL 怎么解决内存是释放的问题?请帮我看看,什么地方错了?
相关话题的讨论汇总
话题: separation话题: degrees话题: degree话题: design话题: six