title: Python: How to create graph nodes and edges from csv file?
body: <p>I have a csv data file where each row denotes one event. A simplified example would be,</p>
  
  <pre><code>  Datetime                 ColA     ColB    ColC   
    2015/07/12 08:45:34      ABC       12      
    2015/07/12 08:46:04      DCD       10     ABC 
    2015/07/12 08:46:23      XYZ       34     ABC 
    2015/07/12 08:46:56      MNO       10     XYZ
    2015/07/12 08:46:56      FGH       20     
  </code></pre>
  
  <p>So, each row will be a <code>node</code> with properties denoted by values of each columns <code>Datetime, ColA, ColB, ColC</code>. Each of these nodes is connected by a relationship between <code>ColA</code> and <code>ColC</code>. </p>
  
  <p>So, in this example there is an edge from row 1 to row 2 and row 3, since <code>ColC</code> of the latter rows is equal to <code>ColA</code> of the first row. Row 3 and row 4 are similarly connected by an directed edge. </p>
  
  <p>Row 1 has no ColC so it is not connected to any nodes higher up, so is row 5. </p>
  
  <p>How can I create a graph data structure to create this relationship in Python? They should all be ordered chronologically, and in case there are two rows with <code>ColA</code> that matches a rows <code>ColC</code>, the one closer in time is chosen. </p>