Questions & Answers Regarding the Assignment
Q1. Do we need to write code in BFS.java or we have to create a file of our own and use Graph.java and BFSOO.java ? -> Create a new class file.
Q2. Do we pass the source vertex to the oddCycle method So that it would look like List oddCycle(Graph g, Vertex src) { … } instead of List oddCycle(Graph g) { … } or should I always use the source vertex as 1? -> Input is a graph. oddCycle method is the API. It may use BFS or any other algorithm to detect odd length cylce which is internal to the method. User need not worry about it.
Q3. Is there any reason for not making the visit() method public in BFSOO? ->visit() is called only by bfs(). Not from outside.
Q4. Should we call readDirectedGraph or readGraph? ->Assume the graph is undirected.
Q5.If there are multiple odd-length cycles, can we output any one of those? ->Yes.
Q6. What is BFSOO.java for? -> we need to use BFSOO.java to solve the problem of odd length cycle.