There was a brief thread on Github which had a useful basic example of how to setup BFS and get some results from it.
The other details specific to your application (creating a random graph, etc.) are obviously not part of this example.
Source:
https://github.com/YaccConstructor/QuickGraph/issues/189#issuecomment-487493207
Here's a complete example:
UndirectedGraph<string, Edge<string>> g = new UndirectedGraph<string, Edge<string>>();
g.AddVerticesAndEdge(new Edge<string>("0", "1"));
g.AddVerticesAndEdge(new Edge<string>("0", "2"));
g.AddVerticesAndEdge(new Edge<string>("2", "3"));
var algo = new UndirectedBreadthFirstSearchAlgorithm<string, Edge<string>>(g);
var observer = new UndirectedVertexPredecessorRecorderObserver<string, Edge<string>>();
var rootVertex = "0";
using (observer.Attach(algo))
{
algo.Compute(rootVertex);
}
var targetVertex = "3";
bool foundPath = observer.TryGetPath(targetVertex, out IEnumerable<Edge<string>> path);
path will then contain the two edges:
[0]: "0"->"2"
[1]: "2"->"3"