Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

semester progress summary #28

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/src/assets/Fixed Graph 3-Coloring.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/src/assets/bags increasing example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/src/assets/example bags and adhesion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/src/assets/example colored bags.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/src/assets/example graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/src/assets/example tree.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/src/assets/fixed graph bags.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/src/assets/fixed graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/src/assets/increasing bag.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/src/assets/nodes increasing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
107 changes: 98 additions & 9 deletions docs/src/pages/decidingsheaves.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ skeletalColoring(n) = skeleton ∘ Coloring(n)
colorability_test(n, the_test_case) = is_homomorphic(ob(colimit(the_test_case)), K(n)) == decide_sheaf_tree_shape(skeletalColoring(n), the_test_case)[1]
```

We can consider the example of a ring with seven nodes as our graph.
We can consider the example of a graph with 5 vertices forming an 'X'.
We first seperate the nodes into bags with adhesions and what our adhesions look like.
Notice that the number of nodes in the graph is equal to the sum of the nodes in each bag minus the adhesions between each bag.

```julia
#bag 1
Expand All @@ -61,15 +62,15 @@ end

#adhesion 1,2
H₁₂ = @acset Graph begin
V = 2
V = 1
end

#bag 2
H₂ = @acset Graph begin
V = 4
E = 3
src = [1, 2, 3]
tgt = [2, 3, 4]
V = 3
E = 2
src = [1, 2]
tgt = [2, 3]
end

Gₛ = @acset Graph begin
Expand All @@ -88,11 +89,99 @@ We can then construct our structured decomposition through transformations of th
Γₛ = FinDomFunctor(
Γₛ⁰,
Dict(
1 => ACSetTransformation(Γₛ⁰[3], Γₛ⁰[1], V=[1, 3]),
2 => ACSetTransformation(Γₛ⁰[3], Γₛ⁰[2], V=[4, 1]),
1 => ACSetTransformation(Γₛ⁰[3], Γₛ⁰[1], V=[2]),
2 => ACSetTransformation(Γₛ⁰[3], Γₛ⁰[2], V=[2]),
),
∫(Gₛ)
)

my_decomp1 = StrDecomp(Gₛ, Γₛ)
```
```

The complete graph is pictured below with the adhesion vertex colored yellow.

<img src='docs\src\assets\example graph.png' width='512' alt='Complete example graph'>

We can recognize the bags that are formed. The bags are pictured as red and blue circles below, overlapping at the yellow adhesion vertex.

<img src='docs\src\assets\example colored bags.png' width='512' alt='Example graph with highlighted bags'>

We can thus split the graph by these bags to form the decomposition shown below.

<img src='docs\src\assets\example bags and adhesion.png' width='512' alt='Example graph split by bags and adhesions'>

and the resulting tree decomposition below.

<img src='docs\src\assets\example tree.png' width='512' alt='Example tree decomposition'>

The algorithm will work by coloring the individual bags then checking if the results will connect at the adhesion point. If no match is found at the adhesion point then there will be a no result.

## Understanding the Complexity

For a c-coloring with tree-width w and total vertices |VT|, we know that to determine a brute force solution we are at complexity O(c<sup>|VT|</sup>). With this dynamic solution we expect complexity of O(c<sup>2w</sup>)|VT|.

We will also consider some other factors. The brute force solution will be better in some edge cases. In a yes instance, if brute force is looking for only 1 solution, a yes instance could get lucky, especially if there are many possible c-colorings. In a yes instance, if brute force is looking for all solutions, the dynamic solution will always be slower in the 2-bag case which can be easily confirmed in the expected complexity calculation. In a no instance, again, the dynamic solution will be slower in the 2-bag case due to the same reason.

## Benchmarking Complexity

As stated above, due to the structure of the algorithm, we expect a complexity of O(c<sup>2w</sup>)|VT| for the dynamic solution. Thus we want to see an exponential decrease in run time as a fixed graph is decomposed into more bags. We also want to show a linear increase in runtime as the number of bags increases linearly and we want to show an exponential increase in runtime as the number of vertices in the graph increases linearly.

First consider the fixed graph case with the following fixed graph.

<img src='docs\src\assets\fixed graph.png' width='512' alt='Example fixed graph'>

We considered the runtime when the graph above is decomposed into smaller and smaller bags as shown below.

<img src='docs\src\assets\fixed graph bags.png' width='512' alt='Example fixed graph decompositions'>

The runtimes for computing if the fixed graph is 3-colorable with varying bag sizes is shown below.

<img src='docs\src\assets\Fixed Graph 3-Coloring.png' width='256' alt='Runtime graph for fixed graph 3-coloring'>

The results show an exponential decrease in runtime as the number of bags is increased on a fixed graph as expected from the complexity calculation above.

Now consider the following benchmarks from increasing the number of bags of a fixed size at a linear rate. When using the following bag of size 4 with some examples below

<img src='docs\src\assets\increasing bag.png' width='128' alt='An example of 1 possible bag used in the benchmarking'>

<img src='docs\src\assets\bags increasing example.png' width='128' alt='Example graphs used in the increasing bag case'>

The following are the results for fixed bags of size 4 and 8 for 2, 3, and 4 coloring tests.

First the results for the fixed bag of size 4 and for a 2-coloring test. The graph shows a linear increase in runtime.

<img src='docs\src\assets\Bags Increasing Linearly of size 4 2 color.png' width='256' alt='Bags increasing size 4 2 coloring results'>

The following results are for the fixed bag of size 4 and for a 3-coloring test. The graph shows a linear increase in runtime.

<img src='docs\src\assets\Bags Increasing Linearly of size 4 3 color.png' width='256' alt='Bags increasing size 4 3 coloring results'>

The following results are for the fixed bag of size 4 and for a 4-coloring test. The graph shows a linear increase in runtime.

<img src='docs\src\assets\Bags Increasing Linearly of size 4 4 color.png' width='256' alt='Bags increasing size 4 4 coloring results'>

The following results are for the fixed bag of size 8 and for a 2-coloring test. The graph shows a linear increase in runtime.

<img src='docs\src\assets\Bags Increasing Linearly of size 8 2 color.png' width='256' alt='Bags increasing size 8 2 coloring results'>

The following results are for the fixed bag of size 8 and for a 3-coloring test. The graph shows a linear increase in runtime.

<img src='docs\src\assets\Bags Increasing Linearly of size 8 3 color.png' width='256' alt='Bags increasing size 8 3 coloring results'>

The following results are for the fixed bag of size 8 and for a 4-coloring test. The graph shows a linear increase in runtime.

<img src='docs\src\assets\Bags Increasing Linearly of size 8 4 color.png' width='256' alt='Bags increasing size 8 4 coloring results'>

These results all confirm the expected complexity from the calculation above.

Now finally consider the following benchmarks for increasing the total vertices in a graph while keeping the number of bags at 2 and the number of adhesions at 1. Below are some examples to illustrate the idea.

<img src='docs\src\assets\nodes increasing.png' width='256' alt='Example of graphs with increasing nodes'>

The following are the results for 2, 3, and 4 coloring tests with similar graphs.

<img src='docs\src\assets\Increase Vertices Linearly 2 color.png' width='256' alt='Nodes increasing results for 2 coloring'>

<img src='docs\src\assets\Increase Vertices Linearly 3 color.png' width='256' alt='Nodes increasing results for 3 coloring'>

<img src='docs\src\assets\Increase Vertices Linearly 4 color.png' width='256' alt='Nodes increasing results for 4 coloring'>
Loading