Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. [Weight = 6] (The three-couple-river-crossing problem continued) You will find a 3Couple. py with this assignment that solves the three-couple-river-crossing problem. Answer the following

image text in transcribedimage text in transcribed
2. [Weight = 6] (The three-couple-river-crossing problem continued) You will find a 3Couple. py with this assignment that solves the three-couple-river-crossing problem. Answer the following questions based on 3Couple . py. a. [Weight = 1] Write additional code to 3Couple . py to print out the graph below in addition to the solution. The printout has to be exactly the same, such as the order of the nodes, spacing, and punctuations. EEEEEEE : (WEEEEEW, WEEEEWW, WEEEWEE, WEEEWEW, WEEWWEE, WEWEEEE, WEWEEEW, WEWEWEE, WWWEEEE) EEEEEEW: (WEEEEWW, WEEEWEW, WEWEEEW, WEWEWEW ) EEEEEWW : {WEEWWWW, WWEWEWW, WWWEEWW) EEEEWEE : (WEEEWEW, WEEWWEE, WEWEWEE, WEWEWEW ) EEEEWEW : { WEEWWWW, WEWEWEW) EEEWWEE: {WEEWWWW, WWEWWWE, WWWWWEE) EEEWWWW : {WWEWWWW, wwwwwww) EEWEEEE : (WEWEEEW, WEWEWEE, WEWEWEW, WWWEEEE) EEWEEEW : {WEWEWEW, WWWEEWW) EEWEWEE : (WEWEWEW, WWWWWEE) EEWE WEW : EWEWEWE : |WWEWEWW, WWE WWWE, WWEWWWW, WWWWEWE, WWWWEWW, WWWWWWE} EWEWEWW : I WWEWWWW, WWWWEWW, Wwwwwww EWEWWWE : {WWEWWWW, WWWWWWE, WWwwwww) EWEWWWW : { WWWWWww EWWEEEE : (WWWEEWW, WWWWEWE, WWWWWEE) EWWEEWW : { WWWWEWW, WWWWwww) EWWWEWE : {WWWWEWW, WWWWWWE, WWwwwww) EWWWEWW : { WWWWWww EWWWWEE : { WWWWWWE, wwwwwww) EWWWWWE : { WWWWWWW WEEEEEW: (EEEEEEE) WEEEEWW : (EEEEEEE, EEEEEEW) WEEEWEE : {EEEEEEE ) WEEEWEW : {EEEEEEE, EEEEEEW, EEEEWEE WEEWWEE : EEEEEEE, EEEEWEE WEEWWWW: {EEEEEWW, EEEEWEW, EEEWWEE) WEWEEEE : JEEEEEEE WEWEEEW : {EEEEEEE, EEEEEEW, EEWEEEE) WEWEWEE : {EEEEEEE, EEEEWEE, EEWEEEE WEWEWEW: {EEEEEEW, EEEEWEE, EEEEWEW, EEWEEEE, EEWEEEW, EEWEWEE) WWEWEWE: {} WWEWEWW : {EEEEEWW, EWEWEWE) WWEWWWE : {EEEWWEE, EWEWEWE) WWEWWWW: {EEEWWWW, EWEWEWE, EWEWEWW, EWEWWWE ) WWWEEEE: {EEEEEEE, EEWEEEE) WWWEEWW: {EEEEEWW, EEWEEEW, EWWEEEE) WWWWEWE : {EWEWEWE, EWWEEEE) WWWWEWW : {EWEWEWE, EWEWEWW, EWWEEWW, EWWWEWE} WWWWWEE : (EEEWWEE, EEWEWEE, EWWEEEE) WWWWWWE : {EWEWEWE, EWEWWWE, EWWWEWE, EWWWWEE) wWwWwWW: {EEEWWWW, EWEWEWW, EWEWWWE, EWEWWWW, EWWEEWW, EWWWEWE, EWWWEWW, EWWWWEE, EWWWWWE) b. [Weight = 1] Which nodes in the printout above are not connected to other nodes? What is the reason for that? c. [Weight = 1] Modify the function genGraph () to exclude the disconnected nodes from the graph (i.e., those identified in (b)) and use the code in (a) to print out the resulted graph.d. [Weight = 1] Draw the graph obtained in (c) by hand (by a program is also fine if you know how). e. [Weight = 1] By inspecting the graph in (d), how many solutions can you obtain for this problem? Explain how you get the answer. f. [Weight = 1] Write a function called criticalNodes () to obtain a set of critical nodes on the graph in (d). A critical node is a node on the graph except the source node and destination node that has a maximum number of links to other nodes. def criticalNodes (G) : Input: a graph G Output: a set of critical nodes and the number of links of each critical node Also include the testing code below after print Path (path) to print out this new information. setCritical, connection = criticalNodes (G) print (" \ The set of critical nodes is", setCritical, "and each has", connection, "connections.") The expected output should be The set of critical nodes is { 'WEWEWEW', ' EWEWEWE' ) and each has 6 connections

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

make HTML FILE ON IT

Answered: 1 week ago