views:

259

answers:

4

this is a totally unfamiliar area for me. can anyone point me in the right direction on how to create a social graph and the best way to represent it? i'm building a website in C#/asp net and need to create a "friends" feature... is this type of thing usually stored entirely in the DB? if so, how?

+1  A: 

Your question is rather open-ended. For drawing complex graphs, one of my favorite tools is Graphviz. Graphviz can work with directed or non-directed graphs. It can take the input as a simple text file, and then output the graph in a variety of formats.

Paul Vincent Craven
+3  A: 

Is your primary concern painting a picture of the social network or storing the data?

For storage you might consider a graph database. However, the most mature product in this space is neo4j, which has the name suggests is written in Java. This SO discussion list some alternative approaches for .Net.

edit

You are still not being clear whether you need design advice or code samples. Andrew Siemer wrote a two-part article which outlines the issues and then presents some ASP.net code. I don't think it's by any means a complete solution but it could give you a steer in the right direction.

APC
basically i need to do what you do on facebook. i need to be able to make friends and then be able to see your friends list, click on them to see their profiles, etc. i just don't know the best way to store this data and how to retrieve/manipulate it.
ijjo
A: 

So your problem is primarily a data storage issue, and how to store and retrieve edges in your graph. Applying some simple graph terms to your problem:

  • Node/Vertex: In your case each person will represent a node.

  • Edge/Link: The relationship between nodes, in this case 'friends', will create an undirected edge between two nodes.

So you will need to maintain a data structure in your DB that allows you to resolve the edge relationships between friends.

Some useful information can probably be found in this question:

challenge-how-to-implement-an-algorithm-for-six-degree-of-separation

Also, something you should consider when deciding how to store your edge list is how many edges you think your site will generate. This will probably effect the storage mechanism you decide on.

Hope those pointers help.

Binary Nerd
A: 

why not just use Facebook's APIs?

Paul