class_docstr: Basic weighted, directed graph class
  
  Member variables:
  
  * V (int): the number of vertices
  * E (int): the number of edges
  
  Methods
  
  * vertices (list, type=int, shape=(V,)): vertices id
  * edges (list, type=int, shape=(E,2)): edges as vertices id tuples
  * weights (list, type=int, shape=(E,)): weights / lengths
    of the graph's edges
class_docstr_tok: ["Basic","weighted",",","directed","graph","class","Member","variables",":","*","V","(","int",")",":","the","number","of","vertices","*","E","(","int",")",":","the","number","of","edges","Methods","*","vertices","(","list",",","type=int",",","shape=","(","V",",",")",")",":","vertices","id","*","edges","(","list",",","type=int",",","shape=","(","E,2",")",")",":","edges","as","vertices","id","tuples","*","weights","(","list",",","type=int",",","shape=","(","E",",",")",")",":","weights","\/","lengths","of","the","graph","'s","edges"]
docstr: Performs a voronoi labelling of the graph
  
  Parameters
  ----------
  seed: array of shape (nseeds), type (np.int_),
        vertices from which the cells are built
  
  Returns
  -------
  labels: array of shape (self.V) the labelling of the vertices
docstr_tok: ["Performs","a","voronoi","labelling","of","the","graph","Parameters","--","--","--","--","--","seed",":","array","of","shape","(","nseeds",")",",","type","(","np.int_",")",",","vertices","from","which","the","cells","are","built","Returns","--","--","--","-","labels",":","array","of","shape","(","self.V",")","the","labelling","of","the","vertices"]
code: def voronoi_labelling(self, seed):
      """Performs a voronoi labelling of the graph
  
      Parameters
      ----------
      seed: array of shape (nseeds), type (np.int_),
            vertices from which the cells are built
  
      Returns
      -------
      labels: array of shape (self.V) the labelling of the vertices
      """
      import heapq
  
      if hasattr(seed, "__iter__") == False:
          seed = [seed]
      try:
          if (self.weights < 0).any():
              raise ValueError("some weights are non-positive")
      except:
          raise ValueError("undefined weights")
      dist, active = np.inf * np.ones(self.V), np.ones(self.V)
      label = -np.ones(self.V, np.int_)
      idx, neighb, weight = self.compact_neighb()
      dist[seed] = 0
      label[seed] = np.arange(len(seed))
      dg = list(zip(np.zeros_like(seed), seed))
      heapq.heapify(dg)
      for j in range(self.V):
          end = False
          while True:
              if len(dg) == 0:
                  end = True
                  break
              node = heapq.heappop(dg)
              if active[node[1]]:
                  break
          if end:
              break
          dwin, win = node
          active[win] = False
          # the following loop might be vectorized
          for i in range(idx[win], idx[win + 1]):
              l, newdist = neighb[i], dwin + weight[i]
              if newdist < dist[l]:
                  heapq.heappush(dg, (newdist, l))
                  dist[l] = newdist
                  label[l] = label[win]
      return label
  
imports: import numpy
  from scipy.sparse import coo_matrix
label_desc: Use image node_id 14 for calling the WeightedGraph obj's underlying member method code with example usage: obj.voronoi_labelling(seed) and returns: label