• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

help: six degrees of separation scripting?

brock

Senior member
forgive me, as i have little background in this sort of thing...

i want to create a database on my webpage of items, all of which are connected to another item. the user can then select two items and see how (if at all) they are connected, a la six degrees of separation. the number of items is going to be rather small, so i don't imagine that this would be too difficult to program.

can anyone get me started or point me somewhere that i might find a script like this?
 
Well, if your gonna use a Relational Database to do this, here's what I'd do.

First of all, you will have to pick some upper limit on the number of things that an item can be linked too. You could make it unlimited, but it becomes a little more difficult to control. Make it like 20 or so (most users would suffer from data overload with more than 20 items at this point)

Second, use indexing rather than replicating data. Then, your row structure basically has the data item, and then a set of indexes that point to the other data items.

Then, your script becomes real simple. Just pick a data item, then present the indexes of the item that are related to the user. The user then selects on one of those, and then you retreive that data item with it's indexes and present that to the user, and so on.

You will have to worry about database cleanup and integrity when you add or delete new links and create the indexes in the first place, or re-gen the database. You don't have to worry about infinite loops (the user with either try all of the indexes, or quit when they have had enough).

DanceMan
 
Back
Top