Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON OR C++ BFS GRAPH PROGRAM Setup: There are two types of professional wrestlers: Babyfaces (good guys) and Heels (bad guys). Between any pair of

PYTHON OR C++ BFS GRAPH PROGRAM

Setup:

There are two types of professional wrestlers: Babyfaces (good guys) and Heels (bad guys). Between any pair of professional wrestlers, there may or may not be a rivalry. There are n wrestlers and a list of r pairs of rivalries.

Python or C++ implementation of the following pseudocode: Create a graph G where each vertex represents a wrestler and each edge represents a rivalry. The graph will contain n vertices and r edges. The program will perform as many breath-first-searches (BFSs) as needed to visit all vertices. Assign all wrestlers whose distance is even to be babyfaces Assign all wrestlers whose distance is odd to be heels. Check each edge to verify that it goes between a babyface and a heel.

Input: Input is read in from a file specified in the command line at run time. The file contains the number of wrestlers, n, followed by their names, the number of rivalries r and rivalries listed in pairs. Note: The file only contains one list of rivalries Output: Results are outputted to the terminal. Yes, if possible followed by a list of the Babyface wrestlers and a list of the Heels . No, if impossible. Sample Input file: 5 Ace Duke Jax Biggs Stone 6 Ace Duke Ace Biggs Jax Duke Stone Biggs Stone Duke Biggs Jax

Sample Output: Yes Babyfaces: Ace Jax Stone Heels: Biggs Duke

PLEASE DEVELOP TO ACCEPT A .TXT FILE!

THANK YOU!!!!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 23rd European Conference Adbis 2019 Bled Slovenia September 8 11 2019 Proceedings Lncs 11695

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Aida Kamisalic Latific

1st Edition

3030287297, 978-3030287290

More Books

Students also viewed these Databases questions