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: Compute the weights  of the graph as a gaussian function
  of the distance  between the corresponding rows of X,
  which represents an embedding of self
  
  Parameters
  ----------
  X array of shape (self.V, dim)
    the coordinate matrix of the embedding
  sigma=0, float: the parameter of the gaussian function
  
  Notes
  -----
  When sigma == 0, the following value is used: ``sigma =
  sqrt(mean(||X[self.edges[:, 0], :]-X[self.edges[:, 1], :]||^2))``
docstr_tok: ["Compute","the","weights","of","the","graph","as","a","gaussian","function","of","the","distance","between","the","corresponding","rows","of","X",",","which","represents","an","embedding","of","self","Parameters","--","--","--","--","--","X","array","of","shape","(","self.V",",","dim",")","the","coordinate","matrix","of","the","embedding","sigma=0",",","float",":","the","parameter","of","the","gaussian","function","Notes","--","--","-","When","sigma","==","0",",","the","following","value","is","used",":","``","sigma","=","sqrt","(","mean","(","||X","[","self.edges","[",":",",","0","]",",",":","]","-X","[","self.edges","[",":",",","1","]",",",":","]","||^2",")",")","``"]
code: def set_gaussian(self, X, sigma=0):
      """
      Compute the weights  of the graph as a gaussian function
      of the distance  between the corresponding rows of X,
      which represents an embedding of self
  
      Parameters
      ----------
      X array of shape (self.V, dim)
        the coordinate matrix of the embedding
      sigma=0, float: the parameter of the gaussian function
  
      Notes
      -----
      When sigma == 0, the following value is used: ``sigma =
      sqrt(mean(||X[self.edges[:, 0], :]-X[self.edges[:, 1], :]||^2))``
      """
      sigma = float(sigma)
      if sigma < 0:
          raise ValueError("sigma should be positive")
      self.set_euclidian(X)
      d = self.weights
  
      if sigma == 0:
          sigma = (d**2).mean()
  
      w = np.exp(-(d**2) / (2 * sigma))
      self.weights = w
  
imports: import numpy
  from scipy.sparse import coo_matrix
label_desc: Use image node_id 11 for calling the WeightedGraph obj's underlying member method code with example usage: obj.set_gaussian(X, sigma) without return types