Finding out, how data is related to another one is easy to be represented as a "Model View Controller".
As an example: If relations between users are build through the buddy.module we know the direct relation between 2 users. What we want to figure out is the "shortest path" between 2 users, who are not buddied.
M: Array of known relations (optionally with weight)
V: Visualisation of the path like shown at http://sna.drupaler.net/?q=de/node/13
C: Dijkstra's algorithm for "Shortest Path"; http://sna.drupaler.net/?q=de/node/10 ; sna.module
If following relations-Model (with weights) exists:
Thomas => Heike (0.1)
Thomas => Robert (0.25)
Thomas => Dries (1.0)
Robert => Dries (0.25)
we want to know who Heike should ask to get a well contact to Dries the shortest path would be:
Heike => Thomas => Dries (with a distance [weight] of 0.1+1.0=1.1)
but the shortest way is:
Heike => Thomas => Robert => Dries (with a distance [weight] of 0.1+0.25+0.25=0.6)
So, the controller gets an array of:
array (
searchfrom,
searchto,
relations(
array(from, to, weight),
array(from, to, weight),
...
)
)
and should return an array of:
array (
distance,
found(
to,
to,
...
)
)
The abstract View is this returned array an may be represented in several ways, like in a google-map, textual or grafical.
Using the buddy.module is done as a well working example. As input data other views are possible, too.
Heike => Documentation, Websites
Thomas => Drupal, Documentation, SoC
Robert => Drupal, PHP, Modules, SoC
Dries => Drupal, PHP, Modules, Architecture
Aron => PHP, Modules, SNA
And the answer to the question "Who should Heike contact to get information about SNA?" is:
Heike =Documentation> Thomas =Drupal/SoC> Robert =PHP/Modules> Aron
Heike =Documentation> Thomas =Drupal> Dries =PHP/Modules> Aron
where the first path would be the better one cause it has more common interests (5 instead of 4).