user4090410
user4090410

Reputation:

How to experimentally simulate and compare various graph cycle detection algorithms?

I studied about various algorithms for cycle detection algorithm in directed graphs like incremental way search, strongly connected components, BFS, two way search, etc. Now I want to simulate it and compare the performance. I am calling cycle detection function whenever I am inserting an edge.

So, my question is what kind of datasets should I consider. If I consider random graphs, then what should be the criteria for evaluation of various algorithms. Some random graph might be of huge size; but they might lead to cycle in a few iterations. It would be helpful if someone can suggest how to go about this.

Also, to compare the performance, does it make sense to remove cycle and then continue insertions again. Once it terminates, compare the execution times of all the implementations?

Upvotes: 1

Views: 67

Answers (1)

Daishisan
Daishisan

Reputation: 290

It really depends on what you're doing this for. In general, there are many random graph generating approaches, but arguably the most famous is Erdos-Renyi. Note though, that for a graph with n vertices to not have a cycle, it must have at most n - 1 edges, so such random graph generators will have a cycle with high probability. Depending on your exact case, you might find it best therefore to keep the graph as sparse as possible (i.e. allow for few edges).

Upvotes: 0

Related Questions