School Commit Init

This commit is contained in:
2024-08-31 12:07:21 +03:00
commit 0b130ee18c
2801 changed files with 4720552 additions and 0 deletions
@@ -0,0 +1,41 @@
class Graph:
def __init__(self,n:int):
'''
Constructs a graph with n vertices numbered from 0 to n-1 and no edges.
'''
pass
def addEdge(self,x,y):
'''
Adds an edge from x to y. Returns True on success, False if the edge already exists. Precond: x and y exists
'''
pass
def parseX(self):
pass
def parseNOut(self,x):
pass
def parseNIn(self,x):
pass
def isEdge(self,x,y):
pass
def print_graph(g:Graph):
print("Outbound")
for x in g.parseX():
print(x,":",end="")
for y in g.parseNOut(x):
print(y," ",end="")
print()
def create_small_graph():
g=Graph(3)
for e in [(0,0),(0,1),(0.2)]:
g.addEdge(e[0],e[1])
return g
def main():
g=create_small_graph()
print_graph(g)