I am very confused about when should I not use this algorithm.
I thought kruskal was used to find the shortest path however i came to know that it is not used to find the shortest path instead Minimum spanning tree. Therefore I became more confused like didn't the MST is used to find the minimum cost hence shortest path ? Since Prims' and Kruskal are used to find the same thing which is MST, then why not ask both topics where someone who has a better foundation clear that up to me.
To find the shortest path between two nodes in a graph where all the edges have zero or equal weight: use depth first searching. This is simple and fast and, if you avoid the recursive versions, able to handle the largest graphs ( millions of edges )
If the the graph edges have different weights, all positive, and you want to find the path with the least total weight then use the Dijkstra algorithm.
The minimum spanning tree algorithms are complex, slow, and are NOT guaranteed to find the shortest path. Do not use them.
By the way, the graph data structure is irrelevant here. All algorithms can use whatever data structure you choose ( adjacency matrix and adjacency list are the most popular ).