Altering the path a Navmesh takes


I am trying to write a guard AI. I have everything set up, including an array of rooms which all have a set value- laid out in a 3 by 3 grid. The guard uses a Navmesh agent and travels to each room by referencing the rooms position. The guard will always travel to the room with the smallest number- but while it is in a room, that number will increment slowly. What I want, is the guard to use Dijkstra’s algorithm to find the shortest path to it’s destination which uses the value of each room as a work value. What this means is, the guard will always go to the room it has least explored least of by using the route it has traveled the least.

And I’m a little stuck on how to do that, exactly. Instantiating game objects that probe the other rooms, which instantiate more game objects to other rooms- until this maps the waypoints the guard need to use, perhaps…?
If anyone has any help to get me started, I would appreciate it. This is for a college project.

Just as an update, I did manage to get it working in the end- using recursive coroutines