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: Extraction of the graphe cliques
  these are defined using replicator dynamics equations
  
  Returns
  -------
  cliques: array of shape (self.V), type (np.int_)
    labelling of the vertices according to the clique they belong to
docstr_tok: ["Extraction","of","the","graphe","cliques","these","are","defined","using","replicator","dynamics","equations","Returns","--","--","--","-","cliques",":","array","of","shape","(","self.V",")",",","type","(","np.int_",")","labelling","of","the","vertices","according","to","the","clique","they","belong","to"]
code: def cliques(self):
      """Extraction of the graphe cliques
      these are defined using replicator dynamics equations
  
      Returns
      -------
      cliques: array of shape (self.V), type (np.int_)
        labelling of the vertices according to the clique they belong to
      """
      if (self.weights < 0).any():
          raise ValueError(
              "cliques definition require a positive graph"
          )
  
      cliques, size = -np.ones(self.V), np.zeros(self.V)
      adj = self.to_coo_matrix()
  
      for k in range(self.V):
          u = cliques < 0
          w = np.zeros_like(u)
          # replicator dynamics iterations
          for q in range(self.V):
              w = u.copy()
              u = (adj * u) * w
              if u.sum() == 0:
                  break
              u /= u.sum()
              if ((w - u) ** 2).sum() < 1.0e-12:
                  break
  
          # threshold the result
          threshold = 1.0 / max(2.0, 1.0 * np.sum(cliques == -1))
          cliques[u > threshold] = k
          if np.sum(u > threshold) == 0:
              break
          size[k] = np.sum(u > threshold)
          if cliques.min() > -1:
              break
      # sort the labels
      size = size[size > 0]
      order = np.argsort(-size)
      label = cliques.copy()
      for k, vv in enumerate(order):
          cliques[label == vv] = k
      return cliques
  
imports: import numpy
  from scipy.sparse import coo_matrix
label_desc: Use image node_id 15 for calling the WeightedGraph obj's underlying member method code with example usage: obj.cliques() and returns: cliques