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: Creates the Minimum Spanning Tree of self using Kruskal's algo.
  efficient is self is sparse
  
  Returns
  -------
  K, WeightedGraph instance: the resulting MST
  
  Notes
  -----
  If self contains several connected components, will have the same number
  k of connected components
docstr_tok: ["Creates","the","Minimum","Spanning","Tree","of","self","using","Kruskal","'s","algo",".","efficient","is","self","is","sparse","Returns","--","--","--","-","K",",","WeightedGraph","instance",":","the","resulting","MST","Notes","--","--","-","If","self","contains","several","connected","components",",","will","have","the","same","number","k","of","connected","components"]
code: def kruskal(self):
      """Creates the Minimum Spanning Tree of self using Kruskal's algo.
      efficient is self is sparse
  
      Returns
      -------
      K, WeightedGraph instance: the resulting MST
  
      Notes
      -----
      If self contains several connected components, will have the same number
      k of connected components
      """
      k = self.cc().max() + 1
      E = 2 * self.V - 2
      V = self.V
      Kedges = np.zeros((E, 2)).astype(np.int_)
      Kweights = np.zeros(E)
      iw = np.argsort(self.weights)
      label = np.arange(V)
      j = 0
      for i in range(V - k):
          a, b = self.edges[iw[j]]
          d = self.weights[iw[j]]
          while label[a] == label[b]:
              j = j + 1
              a, b = self.edges[iw[j]]
              d = self.weights[iw[j]]
  
          if label[a] != label[b]:
              lb = label[b]
              label[label == lb] = label[a]
              Kedges[2 * i] = np.array([a, b])
              Kedges[2 * i + 1] = np.array([b, a])
              Kweights[2 * i : 2 * i + 2] = d
  
      K = WeightedGraph(V, Kedges, Kweights)
      return K
  
imports: import numpy
  from scipy.sparse import coo_matrix
label_desc: Use image node_id 18 for calling the WeightedGraph obj's underlying member method code with example usage: obj.kruskal() and returns: K