Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

completed graph #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

completed graph #10

wants to merge 2 commits into from

Conversation

LacyDraper
Copy link

No description provided.

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lacy, this isn't quite working, but you are on the general path to a BFS approach. Take a look at my comments and let me know what questions you have.

Comment on lines +44 to +45
elif current in green:
green.add(current)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If current is in green add it to green? Is that what you wanted to do here?

red.add(current)

for neighbor in dislikes[node]:
if neighbor not in red or green:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In these if statements you're going to want to establish that:

If current is in red, that the neighbor is not in red
if the current is in green that the neighbor is not in green

Then if the neighbor is not in green or red add the neighbor to the opposite color of current and then append it to the queue.

If the neighbor is in the same color as current return false.


On an entirely different note, you can't do the or like you have it in if neighbor not in red or green:. it would have to be something like if neighbor not in red and neighbor not in green

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants