class Graph(object): def __init__(self, graph_dict=None): ################# # Problem 1: # Check to see if the graph_dict is none # if so, create an empty dictionary and store it in graph_dict ################## #DELETE AND PUT IN THE IF AND ASSIGNMENT STATEMENTS self.__graph_dict = graph_dict ################# # Problem 2: # Create a method called vertices and pass in self as the parameter ################## #DELETE AND PUT IN THE METHOD DEFINITION """ returns the vertices of a graph """ return list(self.__graph_dict.keys()) def edges(self): """ returns the edges of a graph """ ################# # Problem 3: # Return the results of the __generate_edges ################## #DELETE AND PUT IN THE RETURN STATEMENTS
PLEASE HELP, PYTHON THANK YOU
class Graph(object):
def __init__(self, graph_dict=None):
#################
# Problem 1:
# Check to see if the graph_dict is none
# if so, create an empty dictionary and store it in graph_dict
##################
#DELETE AND PUT IN THE IF AND ASSIGNMENT STATEMENTS
self.__graph_dict = graph_dict
#################
# Problem 2:
# Create a method called vertices and pass in self as the parameter
##################
#DELETE AND PUT IN THE METHOD DEFINITION
""" returns the vertices of a graph """
return list(self.__graph_dict.keys())
def edges(self):
""" returns the edges of a graph """
#################
# Problem 3:
# Return the results of the __generate_edges
##################
#DELETE AND PUT IN THE RETURN STATEMENTS
Step by step
Solved in 4 steps with 3 images