I was asked to give an example of a graph that has edges with negative weight, but Dijkstra's algorithm will still give us the correct output. It was part of a prove/disprove question. The claim was.. "If a graph has negative edges, Dijkstra's algorithm will return the wrong output".
Take a look at the simplest possible example: Our graph has only two nodes: $s,t$, and a single edge between them.
In this example, it won't matter what is the cost of this single edge (it can be negative), and Djikstra will always return the only single path between $s$ and $t$: which is directly $s\rightarrow t$.
Yet another way to prove the existence is to take any graph G, and replace one edge E with weight W by two new edges and an intermediate node N. Let the first new edge have weight -W/2 and the other new edge +3W/2.
Any path through these two new edges will still have a contribution W from the two edges together . You still need to prove that Dijkstra works for paths that begin or end in the new node N, but that's fairly straightforward.
Dijkstra's algorithm sometimes works when there are negative weights, and sometimes not, others have given several examples. Allow me to give a few ideas that may make it easier to find an example on your own.
Dijkstra's algorithm never works when there is a negative weight cycle. If a graph has negative weights, but no negative weight cycles, it is possible to modify the graph into a graph where Dijkstra can be applied and the results transformed to find shortest paths in the original graph. One such technique is known as Johnson's algorithm. I think this fact makes it more intuitive that negative weights are not an essential problem for Dijkstra's algorithm, and so we should expect some examples where it just works.
One other setting where Dijkstra will always work is where the only negative edges in the graph are ones leaving the start node $s$ and there are no other edges leaving $s$. The idea is that the algorithm can’t be “surprised” by finding a path whose cost drops as more edges are added in. It’s a great exercise to prove that this indeed is the case; it’s basically a generalization of the regular proof of correctness for Dijkstra’s algorithm.
(This generalizes the excellent answer by @nir shahar.)