# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# +
# Author: <NAME>
# Summer Research with Professor Heather for <NAME> Fellowship 2021
# Some functions to generate polynomials for quantum graphs
# -

# # Imports
#

# +
import numpy as np
from IPython.display import Latex

import HomPolys
# -

#  ## Example 1: A K3 graph
#  A K3 graph is a complete graph on three nodes with three edges.

# First, we compute the edge list for a K3 graph. We expect the output to have three edges.

K3_edges = HomPolys.create_graph_edges("K3")
K3_edges

# We now compute the polynomial representation of the homomorphism number of a K3 graph using a $q$ value of 4, 5, and 6.

# +
# q = 4
poly_4 = HomPolys.Polynomial(4)

# q = 5
poly_5 = HomPolys.Polynomial(5)

# q = 6
poly_6 = HomPolys.Polynomial(6)
# -

# For each initialized polynomial, we use the `add_monomial_from_edge_list` function to add our `K3_edges` from earlier.

poly_4.add_monomial_from_edge_list(*K3_edges)
poly_5.add_monomial_from_edge_list(*K3_edges)
poly_6.add_monomial_from_edge_list(*K3_edges)

# Note that using `add_monomial_from_graph_string` circumvents the entire process, as so:

# +
# q = 4
poly_4_quick = HomPolys.Polynomial(4)
poly_4_quick.add_monomial_from_graph_string("K3")

# q = 5
poly_5_quick = HomPolys.Polynomial(5)
poly_5_quick.add_monomial_from_graph_string("K3")

# q = 6
poly_6_quick = HomPolys.Polynomial(6)
poly_6_quick.add_monomial_from_graph_string("K3")
# -

# We can now view the output of the Polynomials using the `tex` function. Note that `poly_n_quick` is the same as `poly_n` for all values of $n$.

poly_4.tex()

poly_4_quick.tex()

poly_5.tex()

poly_5_quick.tex()

poly_6.tex()

poly_6_quick.tex()

poly_4 == poly_4_quick







StarcoderdataJupyterScriptsDedupFiltered