code: def read(self, file_name, delim=',', sep='\t'):
          
          in_file = open(file_name, 'r')
  
          # Skip the header line
          in_file.readline()
  
          line_number = 2
          for line in in_file.readlines():
              line = line.strip()
              # Skip empty lines
              if not line:
                  continue
  
              words = line.split(sep)
              if not (2 <= len(words) <= 3):
                  raise \
                      IOError("Line {} ".format(line_number) +
                              "contains {} ".format(len(words)) +
                              "columns -- must contain only 2 or 3.")
  
              tail = set(words[0].split(delim))
              head = set(words[1].split(delim))
              if len(words) == 3:
                  weight = float(words[2].split(delim)[0])
              else:
                  weight = 1
              self.add_hyperedge(tail, head, weight=weight)
  
              line_number += 1
  
          in_file.close()
docs: Read a directed hypergraph from a file, where nodes are
          represented as strings.
          Each column is separated by "sep", and the individual
          tail nodes and head nodes are delimited by "delim".
          The header line is currently ignored, but columns should be of
          the format:
          tailnode1[delim]..tailnodeM[sep]headnode1[delim]..headnodeN[sep]weight
  
          As a concrete example, an arbitrary line with delim=',' and
          sep='    ' (4 spaces) may look like:
          ::
  
              x1,x2    x3,x4,x5    12
  
          which defines a hyperedge of weight 12 from a tail set containing
          nodes "x1" and "x2" to a head set containing nodes "x3", "x4", and "x5"