title: Graphs, edges and contextual information
body: <p>I'm new to graph and try to understand how contextual relations can be mapped into them. </p>
  
  <p>I've looked at examples which systematically introduce simple demos (1), for instance:</p>
  
  <pre><code># I want to organize the seating arrangement for my party
  # Bob does not like John, so I can say
  
  -----------                       ------------
  |   Bob   |  &lt;--- excludes ---    |   John   |
  -----------                       ------------
  </code></pre>
  
  <p>But what if I want to say that Bob actually likes John, but does not like being around him when he is accompanied by his girlfriend Mary (you know, they kiss all the time and you cannot talk to them anymore). I've thought about two solutions:</p>
  
  <pre><code># solution 1: create an intermediary node. 
  # now, the problem is that, if I want to know who John excludes, 
  # I have to look at the node John + every other node he might be the child of. 
  
  
                                                      |   John  |
  -----------                       -------------     -----------
  |   Bob   |  &lt;--- excludes ---    |   Couple  | &lt; 
  -----------                       -------------     ------------
                                                      |   Mary   |
                                                      ------------
  
  # solution 2: target the edges, and make them cumulative
  # here if I want to know who John excludes, 
  # I just have to target the node John and then check for 
  # additional logic (in this case, check if Mary is present too).
  
  -----------                       ------------
  |   Bob   |  &lt;--- excludes ---    |   John   |
  -----------             ^         ------------
       ^                  |
        |                 |
  excludes   &lt;---- requires (some logic here)
        |
  ----------
  |  Mary  |
  ----------
  </code></pre>
  
  <p>Note that I did not find any example like this and am even wondering if handling this kind of problem directly in the graph is the right solution. Any thought? Thanks.</p>
  
  <p>(1) eg about neo4j, <a href="http://www.slideshare.net/thobe/django-and-neo4j-domain-modeling-that-kicks-ass/25-The_Neo4j_Graph_data_model" rel="nofollow">http://www.slideshare.net/thobe/django-and-neo4j-domain-modeling-that-kicks-ass/25-The_Neo4j_Graph_data_model</a></p>