Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
scheinerman committed Aug 27, 2024
1 parent b01ec7b commit 5a7ed70
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/build/.documenter-siteinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-08-27T13:11:08","documenter_version":"1.5.0"}}
{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-08-27T13:29:57","documenter_version":"1.5.0"}}
2 changes: 1 addition & 1 deletion docs/build/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -228,4 +228,4 @@
Element 7 in a {16, 65} Int64 poset

julia> subset_decode(integer(ans))
{2,3}</code></pre><h2 id="Implementation"><a class="docs-heading-anchor" href="#Implementation">Implementation</a><a id="Implementation-1"></a><a class="docs-heading-anchor-permalink" href="#Implementation" title="Permalink"></a></h2><p>A <code>Poset</code> is a structure that contains a single data element: a <code>DiGraph</code>. Users should not be accessing this directly, but it may be useful to understand how posets are implemented. The directed graph is acyclic (including loopless) and transitively closed. This means if <span>$a \to b$</span> is an edge and <span>$b\to c$</span> is an edge, then <span>$a \to c$</span> is also an edge. The advantage to this structure is that checking if <span>$a \prec b$</span> in a poset is quick. There are two disadvantages.</p><p>First, the graph may be larger than needed. If we only kept cover edges (the transitive reduction of the digraph) we might have many fewer edges. For example, a linear order with <span>$n$</span> elements has <span>$\binom{n}{2} \sim n^2/2$</span> edges in the digraph that represents it, whereas there are only <span>$n-1$</span> edges in the cover digraph. However, this savings is an extreme example. A poset with <span>$n$</span> elements split into two antichains, with every element of the first antichain below every element of the second, has <span>$n^2/4$</span> edges in either representation. So in either case, the representing digraph may have up to order <span>$n^2$</span> edges. </p><p>Second, the computational cost of adding (or deleting) a relation is nontrivial. The <code>add_relation!</code> function first checks if the added relation would violate transitivity; this is speedy because we can add the relation <span>$a \prec b$</span> so long as we don&#39;t have <span>$b\prec a$</span> already in the poset. However, after the edge <span>$(a,b)$</span> is inserted into the digraph, we execute <code>transitiveclosure!</code> and that takes some work. Adding several relations to the poset, one at a time, can be slow. </p><p>This can be greatly accelerated by using <code>Posets.add_relations!</code> but (as discussed above) this function can cause severe problems if not used carefully.</p><h2 id="See-Also"><a class="docs-heading-anchor" href="#See-Also">See Also</a><a id="See-Also-1"></a><a class="docs-heading-anchor-permalink" href="#See-Also" title="Permalink"></a></h2><p>The <code>extras</code> folder includes additional code that may be useful in working with <code>Posets</code>. See the <code>README</code> in the <code>extras</code> directory. </p><p>Of note is <code>extras/converter.jl</code> that defines the function <code>poset_converter</code> that can be used to transform a <code>Poset</code> (defined in this module) to a <code>SimplePoset</code> (defined in the <a href="https://github.com/scheinerman/SimplePosets.jl">SimplePosets</a> module). </p></article><nav class="docs-footer"><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.5.0 on <span class="colophon-date" title="Tuesday 27 August 2024 13:11">Tuesday 27 August 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
{2,3}</code></pre><h2 id="Implementation"><a class="docs-heading-anchor" href="#Implementation">Implementation</a><a id="Implementation-1"></a><a class="docs-heading-anchor-permalink" href="#Implementation" title="Permalink"></a></h2><p>A <code>Poset</code> is a structure that contains a single data element: a <code>DiGraph</code>. Users should not be accessing this directly, but it may be useful to understand how posets are implemented. The directed graph is acyclic (including loopless) and transitively closed. This means if <span>$a \to b$</span> is an edge and <span>$b\to c$</span> is an edge, then <span>$a \to c$</span> is also an edge. The advantage to this structure is that checking if <span>$a \prec b$</span> in a poset is quick. There are two disadvantages.</p><p>First, the graph may be larger than needed. If we only kept cover edges (the transitive reduction of the digraph) we might have many fewer edges. For example, a linear order with <span>$n$</span> elements has <span>$\binom{n}{2} \sim n^2/2$</span> edges in the digraph that represents it, whereas there are only <span>$n-1$</span> edges in the cover digraph. However, this savings is an extreme example. A poset with <span>$n$</span> elements split into two antichains, with every element of the first antichain below every element of the second, has <span>$n^2/4$</span> edges in either representation. So in either case, the representing digraph may have up to order <span>$n^2$</span> edges. </p><p>Second, the computational cost of adding (or deleting) a relation is nontrivial. The <code>add_relation!</code> function first checks if the added relation would violate transitivity; this is speedy because we can add the relation <span>$a \prec b$</span> so long as we don&#39;t have <span>$b\prec a$</span> already in the poset. However, after the edge <span>$(a,b)$</span> is inserted into the digraph, we execute <code>transitiveclosure!</code> and that takes some work. Adding several relations to the poset, one at a time, can be slow. </p><p>This can be greatly accelerated by using <code>Posets.add_relations!</code> but (as discussed above) this function can cause severe problems if not used carefully.</p><h2 id="See-Also"><a class="docs-heading-anchor" href="#See-Also">See Also</a><a id="See-Also-1"></a><a class="docs-heading-anchor-permalink" href="#See-Also" title="Permalink"></a></h2><p>The <code>extras</code> folder includes additional code that may be useful in working with <code>Posets</code>. See the <code>README</code> in the <code>extras</code> directory. </p><p>Of note is <code>extras/converter.jl</code> that defines the function <code>poset_converter</code> that can be used to transform a <code>Poset</code> (defined in this module) to a <code>SimplePoset</code> (defined in the <a href="https://github.com/scheinerman/SimplePosets.jl">SimplePosets</a> module). </p></article><nav class="docs-footer"><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option><option value="catppuccin-latte">catppuccin-latte</option><option value="catppuccin-frappe">catppuccin-frappe</option><option value="catppuccin-macchiato">catppuccin-macchiato</option><option value="catppuccin-mocha">catppuccin-mocha</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.5.0 on <span class="colophon-date" title="Tuesday 27 August 2024 13:29">Tuesday 27 August 2024</span>. Using Julia version 1.10.4.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>

0 comments on commit 5a7ed70

Please sign in to comment.