Construct a directed acyclic graph with the nodes . The graph should have exactly different paths from the node to the node . The graph can have at most edges, and each edge must be unique.
In a file paths1.py
, implement the function create_edges
that returns the graph as a list of the edges. For example, the list [(1, 2), (4, 5)]
represents a graph with the two edges and .
You can test your function using the class CountPaths
in the course material. In the code template below, the method count_paths
should return .
class CountPaths: # you can copy this class from the course material def create_edges(): # TODO if __name__ == "__main__": edges = create_edges() counter = CountPaths(range(1, 100 + 1)) for edge in edges: counter.add_edge(edge[0], edge[1]) print(counter.count_paths(1, 100)) # 100