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: Sets the graph to be the topological neighbours graph
  of the three-dimensional coordinates set xyz,
  in the k-connectivity scheme
  
  Parameters
  ----------
  xyz: array of shape (self.V, 3) and type np.int_,
  k = 18: the number of neighbours considered. (6, 18 or 26)
  
  Returns
  -------
  E(int): the number of edges of self
docstr_tok: ["Sets","the","graph","to","be","the","topological","neighbours","graph","of","the","three-dimensional","coordinates","set","xyz",",","in","the","k-connectivity","scheme","Parameters","--","--","--","--","--","xyz",":","array","of","shape","(","self.V",",","3",")","and","type","np.int_",",","k","=","18",":","the","number","of","neighbours","considered",".","(","6",",","18","or","26",")","Returns","--","--","--","-","E","(","int",")",":","the","number","of","edges","of","self"]
code: def from_3d_grid(self, xyz, k=18):
      """Sets the graph to be the topological neighbours graph
      of the three-dimensional coordinates set xyz,
      in the k-connectivity scheme
  
      Parameters
      ----------
      xyz: array of shape (self.V, 3) and type np.int_,
      k = 18: the number of neighbours considered. (6, 18 or 26)
  
      Returns
      -------
      E(int): the number of edges of self
      """
      if xyz.shape[0] != self.V:
          raise ValueError(
              "xyz should have shape n * 3, with n = self.V"
          )
  
      if xyz.shape[1] != 3:
          raise ValueError("xyz should have shape n * 3")
  
      graph = graph_3d_grid(xyz, k)
      if graph is not None:
          i, j, d = graph
      else:
          raise TypeError(
              "Creating graph from grid failed. "
              "Maybe the grid is too big"
          )
      self.E = np.size(i)
      self.edges = np.zeros((self.E, 2), np.int_)
      self.edges[:, 0] = i
      self.edges[:, 1] = j
      self.weights = np.array(d)
      return self.E
  
imports: import numpy
  from scipy.sparse import coo_matrix
label_desc: Use image node_id 4 for calling the WeightedGraph obj's underlying member method code with example usage: obj.from_3d_grid(xyz, k) and returns: self