In a previous post I talked about stream evolution. In it I alluded to an evolutionary phase for streams: Contextual Streams. Since then I searched the blogosphere to see if someone had a solution or even a semblance of a model for describing this phase. Unfortunately I only found a list of wants, people are just airing what they want to see in social networks. Typically this is how it goes: They describe what facebook did or did not do till now, they will layout how circles from Google + works and then conclude with what they want to see in Google +. This is all fine, as it provides the social networking leaders with free product suggestions. But the essential problem is, **no one** has **described or ****modeled** a solution. The users rightly feel it is the job of these companies and the companies are so inundated with feature requests and executive mandated deadlines that they have no time or will to think of a ‘pure’ solution. Since no one has a model (as far as I know) I took it upon myself to start on this ginormous task.

First let me start with basics (more advanced (jaded ) readers can skip this paragraph). A social network has two facets: *Structure and Behavior*** . **When we talk about a network, we typically talk about how we are connected to others in the network and also how ‘connected’ we are at the interaction level.

**Graph Theory**is the language of structure, whereas

**Game Theory**is the language of behavior for social networks. A structure is a snapshot of a social network at a particular instance of time. Behaviors define how the structure gets transformed over a period of time. Behavior is the dynamic part of social networks. One might think, that behavior is the cause and structure the effect. But at scale, structure also influences behavior and behavior in turn influences structure, forming a virtuous (or destructive) cycle. A structural model has big implications on the underlying data structures that store and manipulate data. So getting this model right is a fundamental step.

### Current Models

In this post, I would like to propose a model for the structural aspects of a contextual stream. Model is a representation of a system or phenomenon. In computer science, a model is used to simulate a process, concept or operation of the system. My premise is that the existing models are no longer sufficient to explain or operate the *system*. A system is only as good as the model. History abounds with examples where our models were wrong. We moved from “earth is flat” to “earth centric model of the universe” to “Helio centric model of solar system”. Each revision in our models brought about great progress.

The design constraints faced by us today in social networking is similar, because we are limited by our existing models. Before I proceed with a revamped model for the structure of a social network, let me go over what we have today.

A social network is modeled as a graph of ‘friends’. An extension to this in recent years is an affiliation network super imposed on a traditional network of friends.

The rise of groups, lists, circles are an example of this. An affiliation network is modeled as a bipartite graph. A bipartite graph by definition connects two disjoint and independent sets. I took some of my groups from Linked In for illustration purposes.

These two structural models served our purposes till now. The affiliate model came about to serve the need to form communities around shared interests. Accessibility is the only difference between a group on Linked In and a circle in Google +. A circle is a private classification , whereas a group on Linked In is public. (Note: I removed the connections among ‘friends’ to make the model uncluttered)

### Contextual Model

A contextual model is a network of ‘contexts’. Here we model our ‘friends’ as* contexts too *!!!. We can imagine that circles, lists and groups are an attempt to set context. So in effect all circles, lists and groups are contexts in which our social posts reside. By definition *public *is an over encompassing context. It is a set of all possible contexts. Now the key insight is to *model *our friend connections as contexts. If you think about it, when we post to our friends, we are implying a context. Ergo it is true of lists and circles. A *friend* is a circle (list or group) which contains one member. Once we model a friend as a context, then we can use the same language of graph theory to divine better and more information about our *connections* and the *context* in which these play out. Historically affiliations are modeled right after friends, in a typical product iteration cycle. So engineers instead of going back to the drawing board, tack on the affiliations. What I am proposing is to revisit our current models and make *context the fundamental unit* of a social network.

This is just not a jumbled ‘affiliation’ network. There are two key differences, each ‘friend’ is a context (on par with the groups) and the presence of links between groups (Circles) – shown as dashed lines.

Till now, we have viewed these ‘affiliations’ as existing ‘outside’ the network. With the conceptual model we put affiliations, friends and any other ‘contexts’ in the network as nodes. Using such a formulation, we get additional insights by observing the *co-evolution* of contexts and friendships by treating them through a common framework. Theoretically a context can be anything. For e.g. it can be location (check in features), interests, causes, deals, alumni groups, affiliations (as shown above) etc, all unified in one. (To be totally facetious, I am calling it “The General Theory of Social Networks” )

Why this is important and powerful, needs a little bit of explanation and theoretical exploration. It has got to do with *Closures and Hypergraphs*.

### Closures

Closure is the “act of closing”. It is the primary mechanism through which PYMK (People you may know) feature is implemented. Closures imbue social networks with the ability to grow organically. In literature there are three types of closures which have been extensively studied: Triadic Closure, Focal Closure and Membership Closure.

Here focus corresponds to a group, interests, lists or circles.

#### Triadic Closure

If two people in a social network have a friend in common, then there is an increased likelihood of they becoming friends themselves at some point in the future. If A and B have edges to C, then there is a high probability that an edge will form between A and B. PYMK feature is based on this principle of triadic closure.

#### Focal Closure

By introducing affiliations in to the network, focal closure comes in to play. If two people have an affiliation (focus) in common, then there is an increased likelihood of they becoming friends. If A and B are members of C, then there is high probability that an edge will form between A and B. This has intuitive appeal, as by their membership of C, they have indicated that they share common interests and passions. So it is advantageous for them to be friends themselves.

#### Membership Closure

If two people are friends and one of them is a member of a particular affiliation, then it is quite likely that the member would introduce his friend to the group and in turn becomes its member. That is membership gets ‘closed’ as result. More formally, if A is a friend of B and B is a member of C, then there is high probability that A will also become a member of C in future.

#### Contextual Closure

We do see all of the above closures happening today on social-affiliation networks. But there is one more closure, that is yet to happen. This is not a *new type of closure*, but an artifact of modelling contexts as *fundamental units* of social networks. This type of closure is the ‘general’ solution to all of the above. If all *three contexts are people*, then it becomes triadic closure. If one of the contexts is a focus (or group/circle/list), then it can become either a focal or membership closure (See above).

The interesting thing that happens above and beyond this is the case when we operate on *three contexts. *Either *two of them are groups and one person* OR *all three are groups*. In the case of two groups, nothing can be gained by an individual instance of a person belonging to two groups. Interesting things happen, when we see the results in aggregate. If a multitude of people contexts are members of two separate group contexts, then we can safely predict that either these group contexts will merge in to one or will have a ‘connection’ to each other. If all three are group contexts and one group context is linked to two other groups, there is a high likelihood of triadic closure happening on group contexts. Also there is an increased likelihood of focal and membership closures happening on people contexts contained within the group contexts.

This brings us to the point, where we understand how contextual modelling helps us achieve greater and more organic growth of social networks. Since it is more contextual it is more valuable to the end user as well as the social network. More information can be mined and more ‘intents’ can be readily perceived. The forcing functions of selection and social influence are amplified to a great extent. I can only wonder, if we pull this off at scale, it would be a gold mine of hidden motivations and real social behaviors. From a computational stand point, we only need one common language to handle all the nodes and edges in the network. We can co-locate ‘disparate’ data in one storage model, since they are all contexts. This greatly simplifies data mining and querying capabilities. Each new node and edge adds more context, like pieces of a puzzle, the later pieces provide ‘global context’ for solving the whole puzzle.

Our existing 2 planar network will not suffice. With the explosion of contexts and the fact that a context can belong to other contexts, it would soon become just data and no information. We would need a mathematical structure that underpins this form and help us navigate the contextual social network. The traditional two vertices connected by an edge will not be enough. So what can replace this? What kind of data structures can support this? It should be robust and computationally solid. Also the new solution, keeping the central theme going, should also support current investments as well as provide a solution to n-planar networks. What this means is that 2-planar network model should be a an instance of a more general solution. Enter Hypergraphs!!!

### Hypergraphs

In mathematics, a *hypergraph *is a generalization of a graph, where the *edges* can connect any number of *vertices*. Formally, a hypergraph H is a pair (X,E), where X is *a set of vertices* (nodes) and E is a *non empty set of subsets* of X, called *hyperedges*. So E is a subset of P(X), where P(X) is a power set of X.

A *hypergraph* with all *hyperedges* of cardinality 2 is a graph as we know it. More generally we can define a k-uniform hypergraph as a hypergraph, such that all its *hyperedges* have size * k. *So a graph is just a 2-uniform hypergraph, satisfying our requirement of fitting current models, while enabling us to extend.

Hypergraph traversals are very important in the fields of machine learning, data mining, game theory etc. It is too vast a subject to explore in this post.

### Conclusion

In conclusion, we can see how moving to a contextual model, helps us immensely, both from a conceptual as well as computational stand point. Better models and underlying mathematical structures will force streams in to the next evolutionary phase. Of course there is a lot to do on the UI/UX side to make all of this intuitive to the end user. But I suspect that it would be easier than the contortions that the users go through now. Modelling behavior is another beast that we need to tackle sooner than later. Current behavioral models are quite complex and I would imagine a contextual behavioral model would be even more so.

As always, please let me know if there is any work in progress in this direction somewhere. My limited search abilities did not uncover anything of substance. If there is anything at all, I am sure it is spread out in different fields, areas and silos. The need of the hour is to bring all of this to the main stream.