DiscreteNeuralNets/tests/test_dominion.py
2025-07-20 14:20:25 -06:00

39 lines
1.1 KiB
Python

"""
Tests for creating and storing dominions
"""
import src
from dominion import random_dominion
from graphs import random_tree
print('Create a random dominion of size 4 with labels {0,1,2}.')
D = random_dominion(4, range(3))
print('Show some information about this dominion.')
print(D)
print('Display the dominion we created.')
D.show()
print()
print('We can also demand that only certain labels can appear next to each \
other.')
print('We will use a tree to illustrate this, although we could have used any \
kind of graph we like.')
print('The vertices of our tree will be {0,1,2,3,4,5}.')
T = random_tree(range(6))
print(T)
print('Create a new random dominion of size 10 with labels {0,1,2,3,4,5} and \
display it.')
D = random_dominion(10, range(6), T)
D.show()
print()
print('We can also save an image of this dominion as a file.')
print('We\'ll use `magma` for our color map.')
D.draw('magma', 'dominion_draw_test')
print()
print('Let\' see how long it takes to make a bigger dominion and draw it.')
D = random_dominion(1000, range(6), T)
D.draw('magma', 'dominion_draw_test_big')
print()