Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

syotos

  • 3 years ago

Any one working on pset11? I wrote some code for "bruteForceSearch",but get error in the idle. p11_src(Details are described between line 38 and 54): http://pastebin.com/iQXPjWfd and for graph.py(include some class def by myself): http://pastebin.com/UGG6fsqC ----------------------------------------------------- I do some test on my code but get even more confused results, addtional info has been added between line 56 and 80.Sorry to bump aggain,this one can really got a rookie like me crazy...

  • This Question is Closed
  1. bwCA
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    so the traceback tells you exactly what the problem is (lines 47 and 48 of your first paste). that looks like a 'custom' error. you need to find the line of code that says raise ValueError... "Start or end not in graph." and determine what causes it. then work backward from there - that's what make raising errors nice, especially if you put descriptive info in their arguments

  2. syotos
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Thanks.I'm still trying..

  3. bwCA
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    looks like the digraph is missing a start or end node - line 112,113 of the first paste

  4. syotos
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    I print the whole campus map in IDLE.Now i am sure that the 'rode' "32->56"is in my graph,but somehow it looks like the node 32 and 56 is not there. A pretty confusing one,huh? .... I am trying to trace the real problem from line 112 and 113...Maybe the error was raised in the addNode()?

  5. bwCA
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    well i didn't try to run it, but it stopped executing because of a ValueError("Start or end not in graph."). How many places in the code can this happen? did you search for the following? raise ValueError("Start or end not in graph.") i think it had to get to that line and then digraph was deficient - maybe add some more info to the exception ... http://dpaste.com/811827/

  6. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy