from contiguous import *from linked import *from pair import * class DirGraph: ## DirGraph(num) produces a directed graph with num vertices with ## IDs 0 through num-1. ## __init__: Int -> DirGraph ##...

from contiguous import *from linked import *from pair import *
class DirGraph:

## DirGraph(num) produces a directed graph with num vertices with ## IDs 0 through num-1. ## __init__: Int -> DirGraph ## Requires: num is positive def __init__(self, num):


## self.num_vertices() produces the number of vertices in self. ## num_vertices: DirGraph -> Int def num_vertices(self): ## self.vertex_value(one) produces the value of the vertex with ID ## one in self. ## vertex_value: DirGraph Int -> Int ## Requires: 0 def vertex_value(self, one):

## self.in_neighbours(one) produces a list of IDs of in-neighbours of ## the vertex with ID one in self. ## in_neighbours: DirGraph Int -> (listof Int) ## Requires: 0 def in_neighbours(self, one):

## self.out_neighbours(one) produces a list of IDs of out-neighbours of ## the vertex with ID one in self. ## out_neighbours: DirGraph Int -> (listof Int) ## Requires: 0 def out_neighbours(self, one):
There is more!
Nov 14, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here