I think there is a couple ways to make your path finder algorithm work with a directed graph.

You addEdge function line 103 make your graph undirected, remove line 108 and you will be working with a directed graph. There is now two ways to proceed.

When node A is at the bottom of the up escalator and node B at its top and node X is the top of the down escalator and node Y at its bottom then your list from line 368 would look like

```
g.addEdge(vertices[0], vertices[2]);
g.addEdge(vertices[2], vertices[0]);
g.addEdge(vertices[0], vertices[3]);
g.addEdge(vertices[3], vertices[0]);
g.addEdge(vertices[1], vertices[3]);
g.addEdge(vertices[3], vertices[1]);
.....
.....
```

where direction between nodes does not matter

and where direction does matter add edge only once.

```
g.addEdge(vertices[A], vertices[B]);
g.addEdge(vertices[X], vertices[Y]);
```

The alternative is to change the addEdge function to

```
addEdge(directed,src,dest)
{
this.AdjList.get(src).push(dest)
if(!directed) {
this.AdjList.get(dest).push(src);
}
}
```

and then

```
g.addEdge(false, vertices[0], vertices[2]);
g.addEdge(false, vertices[0], vertices[3]);
g.addEdge(false, vertices[1], vertices[3]);
.....
.....
g.addEdge(true, vertices[A], vertices[B]);
g.addEdge(true,vertices[X], vertices[Y]);
```