Hi everyone! I’m relatively new to python and had a question about runtimes for algorthims, specifically prim’s algorthim. The pseudocode for prim’s algorthim is given below. my question was regarding the runtime for this algorithm?

Currently, the runtime is Big O(V+VlogV+ElogV), however, I am a bit confused about where the VlogV and ElogV are coming from? Any explanation would be of great help! Thank you!

```
MST-PRIM(G, w, r)
for each u in G.V
u.key = infinity
u.parent = NIL
r.key = 0
Q = G.V
while Q != {}
u = EXTRACT-MIN(Q)
for each v in G.Adj[u]
if v in Q and w(u,v) < v.key
v.parent = u
v.key = w(u,v)
```