I'm looking for an algorithm that if we pass an adjacency matrix (graph) and a node, we can get the shortest path from every node to that node. I was investigating about Dijkstra algorithm. I like it because its complexity is O(V*lg(V)), the problem is that Dijkstra finds the shortest path from one node to all the nodes, I want the opposite: The shortest path from all the nodes to one node. I can use Dijkstra only if I work with undirected graphs, but if I use a directed graph, it won't work.
I also was investigating about Floyd-Wharshall, I don't really like it for this problem, because its complexity is O(n^3) and it finds the shortest paths from all the nodes to all the nodes and I just want the shortest paths from all the nodes to one specific node.
Something like this:
it graph[n][n];
int node = 2;
int *shortest_paths = algorithm(graph, node)
Maybe there can be a variant of Dijkstra that I don't know.