forked from AnotherSkyBoi/COSC-4353-Group-A
-
Notifications
You must be signed in to change notification settings - Fork 0
/
testAddNode.py
24 lines (22 loc) · 1.03 KB
/
testAddNode.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from classes import *
def testAddNode():
possibleCases = [True, False]
count = 1
for isMultiGraph in possibleCases:
for isDirected in possibleCases:
for isWeighted in possibleCases:
for n in range(2,21):
numNodes = n
if isDirected:
numConnections = n*(n-1)
else:
numConnections = floor(n*(n-1)/2)
g = Graph(seed=2, numNodes=numNodes, numConnections=numConnections, name="", date="", description="", weightsRange=[1,5], isMultiGraph=isMultiGraph, isDirected=isDirected, isWeighted=isWeighted)
count += 1
originalNumberOfNodes = len(g.adjacencyLists.keys())
g.addNode(str(originalNumberOfNodes))
newNumberOfNodes = len(g.adjacencyLists.keys())
if newNumberOfNodes != originalNumberOfNodes+1:
print("False")
return
print("True")