Skip to content

Commit

Permalink
fix a url issue in of the vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
boennecd committed May 20, 2022
1 parent 4e5119d commit dc0817f
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 17 deletions.
6 changes: 3 additions & 3 deletions create-vignette.Rout
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ label: unconnected_largest_ex

output file: pedigree_partitioning.knit.md

/usr/bin/pandoc +RTS -K512m -RTS pedigree_partitioning.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output pedigree_partitioning.html --lua-filter /home/boennecd/R/x86_64-pc-linux-gnu-library/4.1/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /home/boennecd/R/x86_64-pc-linux-gnu-library/4.1/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --variable bs3=TRUE --standalone --section-divs --template /home/boennecd/R/x86_64-pc-linux-gnu-library/4.1/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/RtmpPelT5n/rmarkdown-str24e5540a0893.html --filter /usr/bin/pandoc-citeproc
/usr/bin/pandoc +RTS -K512m -RTS pedigree_partitioning.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output pedigree_partitioning.html --lua-filter /home/boennecd/R/x86_64-pc-linux-gnu-library/4.1/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /home/boennecd/R/x86_64-pc-linux-gnu-library/4.1/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --variable bs3=TRUE --standalone --section-divs --template /home/boennecd/R/x86_64-pc-linux-gnu-library/4.1/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/RtmpTRWc5f/rmarkdown-strd227629a578e.html --filter /usr/bin/pandoc-citeproc

Output created: pedigree_partitioning.html

Expand Down Expand Up @@ -2195,7 +2195,7 @@ List of 1

output file: pedmod.knit.md

/usr/bin/pandoc +RTS -K512m -RTS pedmod.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output pedmod.html --lua-filter /home/boennecd/R/x86_64-pc-linux-gnu-library/4.1/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /home/boennecd/R/x86_64-pc-linux-gnu-library/4.1/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --variable bs3=TRUE --standalone --section-divs --template /home/boennecd/R/x86_64-pc-linux-gnu-library/4.1/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/RtmpPelT5n/rmarkdown-str24e5624a5e37.html --filter /usr/bin/pandoc-citeproc
/usr/bin/pandoc +RTS -K512m -RTS pedmod.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output pedmod.html --lua-filter /home/boennecd/R/x86_64-pc-linux-gnu-library/4.1/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /home/boennecd/R/x86_64-pc-linux-gnu-library/4.1/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --variable bs3=TRUE --standalone --section-divs --template /home/boennecd/R/x86_64-pc-linux-gnu-library/4.1/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/RtmpTRWc5f/rmarkdown-strd227efb4ca0.html --filter /usr/bin/pandoc-citeproc
[WARNING] This document format requires a nonempty <title> element.
Please specify either 'title' or 'pagetitle' in the metadata,
e.g. by using --metadata pagetitle="..." on the command line.
Expand Down Expand Up @@ -4225,4 +4225,4 @@ Output created: README.md
>
> proc.time()
user system elapsed
163.833 1.356 246.682
155.793 1.187 239.794
Expand Down
40 changes: 38 additions & 2 deletions vignettes/pedigree_partitioning.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -463,13 +463,13 @@ show_split(sim_dat, max_part)
```

Our implementation of the method by @Chlebíková96 is outlined at
[cstheory.stackexchange.com/q/48864/62145](https://cstheory.stackexchange.com/q/48864/62145).
[Implementation Details](#implementation-details).
Currently, we re-compute the cut vertices (articulation points) at every
iteration but it may be possible to update these which presumably will be faster
and reduce the overall computation time. We do find a perfectly balanced
partition
above where each set is of size 25. However, we cut `r NROW(removed_edges)` edges
to this. Thus, we implemented a greedy method to reduce the number of cut edges
to do this. Thus, we implemented a greedy method to reduce the number of cut edges
while maintaining a roughly balanced connected partition which we outline next.

Given an approximately balanced connected partition $(V_1, V_2)$ and vertex
Expand Down Expand Up @@ -700,5 +700,41 @@ NROW(max_part$removed_edges) # number of removed edges
The method completely failed this time except when we started from the
balanced connected partition.

### Implementation Details

The algorithm by @Chlebíková96 is given below.
Given a block (2-connected graph) $G=(V,E)$ and a vertex weight function $w$:

0. Order $V$ in such a way that $w(v_1) \geq w(v_2) \geq w(v_3) \geq \dots$.
Initialize $V_1 = \{v_1\}$ and $V_2 = V\setminus V_1$.
1. If $w(V_1) \geq w(V)/2$ then go to 3. else go to 2.
2. Let
$$V_0 = \left\{u \in V_2 \mid \left(V_1 \cup \{u\}, V_2 \setminus \{u\}\right) \text{ is a connected partition of }G\right\}.$$
Choose $u = \text{arg min}_{v\in V_0} w(v)$.
If $w(u) < w(V) - 2w(V_1)$ then set
$V_1 := V_1 \cup \{u\}$ and $V_2 := V_2 \setminus \{u\}$ and go to 1. else go to 3.
3. Return $(V_1, V_2)$.

The $V_1 \cup \{u\}$ condition in step 2. is easy to deal with as one can keep track of vertices that have neighbors in the other set.
We cannot remove $u\in V_2$ in 2. if $u$ is an articulation point (cut vertex)
of $V_2$ as then $V_2$ is no longer connected. Therefore, an implementation
may look as follows:

0. Find $v_1 = \text{arg max}_{u \in V} w(u)$.
Initialize $V_1 = \{v_1\}$ and $V_2 = V\setminus V_1$.
Create the sets
$$\begin{align*}
I &= \left\{u \in V_2 \mid u \text{ has an edge to any vertex } v \in V_1\right\} \\
A &= \left\{u \in V_2 \mid u \text{ is an articulation point of }V_2\right\}.
\end{align*}$$
1. If $w(V_1) \geq w(V)/2$ then go to 4. else go to 2.
2. Let $V_0 = I \setminus A$.
Choose $u = \text{arg min}_{v\in V_0} w(v)$.
If $w(u) < w(V) - 2w(V_1)$ then go to 3. else go to 4.
3. Set $V_1 := V_1 \cup \{u\}$ and $V_2 := V_2 \setminus \{u\}$.
Update $I$ and $A$ and go to 1.
4. Return $(V_1, V_2)$.

We can find the articulation points in $\mathcal O(\lvert V_2\rvert)$ using the method suggested by @Hopcroft73 and we do not need to do anything for every vertex $u\in I$. Perhaps we can update $A$ quicker then this though.

## References
52 changes: 40 additions & 12 deletions vignettes/pedigree_partitioning.html

Large diffs are not rendered by default.

0 comments on commit dc0817f

Please sign in to comment.