title: Getting nodes without edges (When the N is larger than 60)
body: <p>First I generated an NxN matrix of zeros and ones using NumPy. After that, I generated a copy matrix from the previous matrix, I replaced the ones in the first matrix with the weight of the edges. ( The matrix is symmetric and connected and undirected and its diagonal is zero like the original matrix) and I used BSF to check if it's connected and I found it connected every time. Then I used SciPy to find the MST (Minimum Spanning Tree). After that, I illustrated the MST using Network X</p>
  <p><em><strong>for generating NxN Matrix of zeros and ones</strong></em></p>
  <pre><code>base = np.zeros((shape,shape))
  for _ in range(100):
      a = np.random.randint(shape)
      b = np.random.randint(shape)
      if a != b:
          base[a, b] = 1
          base[b, a] = 1
  </code></pre>
  <p><em><strong>for generating NxN Matrix with the weight of edges</strong></em></p>
  <pre><code># Fetch the location of the 1s.
  Weightofedges = base
  ones = np.argwhere(Weightofedges == 1)
  ones = ones[ones[:, 0] &lt; ones[:, 1], :]
  
  # Assign random values.
  for a, b in ones:
      Weightofedges[a, b] = Weightofedges[b, a] = np.random.randint(100)
  </code></pre>
  <p><em><strong>Find the MST using SciPy</strong></em></p>
  <pre><code>from scipy.sparse.csgraph import minimum_spanning_tree
  X = minimum_spanning_tree(Weightofedges)
  print(&quot;The Output Of The MST By Kruskal Algorithm:&quot;)
  print(&quot;  Edges:    Weights:&quot;)
  print(X)
  print(&quot;-----------------------&quot;)
  my_matrix3 = X.toarray().astype(int)
  </code></pre>
  <p>The Problem: When I input a matrix with a large number of nodes I got some nodes not connected with an edge
  e.g.
  Number Of Nodes equals 75
  Number Of Edges equals 65
  In the MST the edges must be N-1 where N is the number of nodes</p>
  <p>This is the graph using N = 75 ( as shown there are nodes without edges )
  <a href="https://i.stack.imgur.com/sk0wy.png" rel="nofollow noreferrer">enter image description here</a></p>