Implementation of Dijkstra's Algorithm in a Dynamic Microgrid for Relay Hierarchy Detection