The Bellman-Ford algorithm works on directed graphs. To make it work with undirected graphs we must make each undirected edge into two directed edges (one in each direction) with the same weights as the original undirected edge.
Does Dijkstra work for undirected graphs?
You can use Dijkstra's algorithm in both directed and undirected graphs, because you simply add edges nodes into the PriorityQueue when you have an edge to travel to from your adjacency list.
Is Bellman Ford a directed graph?
Steps of Bellman-Ford Algorithm
This algorithm takes as input a directed weighted graph and a starting vertex. It produces all the shortest paths from the starting vertex to all other vertices.