Results 1 to 2 of 2
  1. #1
    agentmarine is offline Member
    Join Date
    Nov 2012
    Rep Power

    Default [Assignment] BFT using Directed Graphs, but having an issue with the traversal.

    Hey every one, First time here on the forums and hopefully not my last.

    I've been working on my assignment for a little over 3 weeks now, however I started it with the wrong type of algorithm, but that's not an issue now and I have the correct algorithm, but I've got an issue where I have a bot that is attempting to traverse a directed graph how ever, on some occasions the BFT (Breadth First Traversal) algorithm being used is not generating the correct array result, causing the bot to crash and die a horrid and unfortunate death.

    I've posted the bot code, maze and the debugging information here on pastebin, new maze -

    from what I can figure is that although the BFT algorithm is finding the exits appropriately, I don't think it is being put into the array list properly, and so when it comes to time where the bot is supposed to traverse the graph using the chooseNextNode() method, it tries to move to a node that isn't a neighbour of the node that is in the provided array list. causing the bot to crash, how ever i cant figure out for the life of me how to fix this, or why it is happening.

    Any help on this would be greatly appreciated.


  2. #2
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Rep Power

    Default Re: [Assignment] BFT using Directed Graphs, but having an issue with the traversal.

    So, you need to approach it like this:
    Start with a really simple graph and run your algorithm. See if you can reproduce the problem with the simplest tree you can find. Once you have an input that reliably reproduces the bug, you need to step through your code with the debugger while simultaneously doing it on a sheet of paper. This is the only way to find where your algorithm is in error - you might have an unhandled edge case or an off by 1 error somewhere.

Similar Threads

  1. Focus - Traversal Issue
    By newbie123 in forum AWT / Swing
    Replies: 0
    Last Post: 05-30-2012, 11:14 PM
  2. how to find MST in a directed graph?
    By dacoolest in forum New To Java
    Replies: 1
    Last Post: 01-11-2012, 08:42 PM
  3. Self-directed learning
    By Mr.Beans in forum Forum Lobby
    Replies: 3
    Last Post: 05-05-2009, 10:40 PM
  4. How to treverse a Directed Acyclic Graph
    By TalhaS in forum New To Java
    Replies: 0
    Last Post: 03-19-2008, 08:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts