Simplification of time complexity notation

26 Views Asked by At

I want to simplify a big O time complexity notation for my algorithm. The algorithm calculates relative distances between a subset of sampled nodes Vs and all other nodes V in graph G through a single-source shortest path algorithm with time complexity O(V+E). This would result in an overall complexity of O(V(Vs(V+E))) with practical implementation:

for node in V:
    for sampled node in Vs:
        single-source shortest path calculation(node, sampled node)

Can I simplify this to a complexity of O(Vs(V2+VE)) which would then be approximately O(V3) ?