text:
Forum moved here!

# Home / -config-path option for portable SumatraPDF

Proger

Hello!
First, thank very much to the developers for a great and free tool!
I am using SumatraPDF as a viewer with “Altap Salamander” file manager, and I have a question:

Is it possible to add an option (like “-config-path”) for the portable version to specify the exact location of the configuration file?

Because SumatraPDF runs as plug-in from Salamander, it’s good to pass the correct path to the configuration file, and great, if all configuration changes to also save in it.
I tried putting the configuration file near SumatraPDF.exe, but it doesn’t work if SumatraPDF is inside %ProgramFiles% (or in nested folders). I have it in %ProgramFiles%\Altap Salamander\ext-viewers\SumatraPDF\SumatraPDF-settings.txt and it’s not working, still creating a configuration file in %localappdata%\SumatraPDF…

GitHubRulesOK

The portable version (single .exe) will always use its own folder for settings, but you must have User Access Control rights to write to that folder. However, if you wish, you can also specify an alternative appdata folder.

Try “Path to\SumatraPDF.exe” -appdata “Path to\FolderName” containing SumatraPDF-settings.txt

e.g. -appdata “%ProgramFiles%\Altap Salamander\ext-viewers\SumatraPDF”

Your UAC elevation or the folder properties security may need changing to allow you to make editor changes in said folder\file. Hence by default it is saved in your personal %localappdata%\SumatraPDF which should not be a problem for 99.9% of users

Proger

It’s worked!
But, Salamander can’t send relative path for external plugin/viewer .exe, it work only with absolute path (can change with portable use of Salamander)…
Is it possible to send with -appdata path to Sumatra’s executable?

What I don’t understand is why it check for a .exe inside %program files% when it’s more logical, if configuration file in the same folder as the SumatraPDF.exe, to take parameters from it rather than from %localappdata%?

GitHubRulesOK

Am slightly confused by your usage.
Using Sumatra portable from elsewhere (e.g. portableapps version) may cause problems. ONLY use the ones from https://www.sumatrapdfreader.org/download-free-pdf-viewer.html NO OTHER, they may mess with the defaults, and behave as you describe.

Portable should not normally be in “program files” since that is a more restrictive area

Most users would either be using a portableapps directory on a usb drive or a dedicated c:\portableapps or similar folder (avoid using dropbox / google drive or similar)

The dedicated portable versions expect to be in a read/write directory without the need to run as admin, and in that case they use their own directory for data including crash folder and cache. Then there is no need to specify -appdata.

The use of %variable% depends how your system is configured so -appdata can be different for portable use on different drives or say you need one startup to be different to another, but remember two settings = two histories.

The simplest way to control portable settings is use a cmd file to detect running drive and self adjust the appdata settings if needed. however Altap Salamander seems to accept enviroment settings. So you should be able to use one during start up if necessary. I had no problem using a portable altap on one drive with a portable from this site on another using fixed locations but did not try relative variables as I just wanted to check for the default settings file in the exe dir.

Just to check env vars work I set pdf F3 action to work with an old one I use \$[MOZ_PLUGIN_PATH]

and got the expected older version which then saved its settings in its own folder no hint of any appdata at all


text:
# Sub-Graphs and Trees

After we’ve seen in the last post an elegant example for using graph to solve a problem, it’s now time to proceed and meet some more definitions.

In math, when we are dealing with a structure, we usually like to define a sub-structure, examples for that are: sub-set, sub-group, sub-vector space and so on. The same thing applies to graphs as well, so let’s do it:

## Sub-Graphs

Let $G=(V,E)$ be a graph. We say that $H=(U,E^\prime)$ is a sub-graph of $G$ if:

• $U\subseteq V$
• $E^\prime \subseteq E \cap (U\times U)$

In simpler words, A subgraph is just a graph which is made from vertices and edges from $G$. We denote it by $H \subseteq G$.

Here the higher graph is indeed a sub-graph, however, the bottom graph is not a sub-graph, since we’ve ‘added’ an extra edge.

A sub graph $H\subseteq G$ is said to be a spanning sub-graph, if $V(G)=V(H)$. This is just a sub-graph that has all the vertices of the original graph. The sub graph in the above is not a spanning sub-graph, since it contains only 3 verticesf rom the original graph, and not all of them.

That’s an example of a spanning sub-graph, it is indeed a sub-graph that contains all of the original graph’s vertices.

Finally, for a set of vertices $U\in V$ we will denote by $G[U]$ the spanned sub-graph on $U$ which is defined as the sub-graph with $U$ as it’s set of vertices, and the edges of it, will be all the edges between vertices in $U$ that exists in $G$. Formally:

G[U]=(U,\{e\in E:e\subseteq U\})

That’s an example for a spanned subgraph on the set of the marked vertices.

After wev’e seen all those defintions, right now I won’t prove anything related to them, however, they will play an important role in the future.

## Forest & Trees – The graphs

A graph $G$ is called a Forset if it has no cycle. If it is also connected, then it is called a Tree.

What? why would you call it like that? let’s see some visual examples of trees first:

I think that kinds of explains itself… those graph look like umm… trees, I am not talking about trees in a park or something like that (although it looks like roots of those trees) I am talking about family trees and stuff like that. If we consider all those trees a single graph, we get a graph which is not connected, and we called it a forest. Thus, a forest is just a bunch of trees, that is actually makes sense.

if $G$ is a forest, then a vertex with degree 1 is called a leaf, that’s also pretty intuitive, considering the forest in the above.

We are now ready to prove a lemma: If $G$ is a tree with two or more vertices, then it has at least two leaves. Let’s prove it:

First off all, since $G$ has at least two vertices, and it is connected as a tree, there must be an edge in it. We are now going to take the longest path in $G$, which we will denote by $P=(v_0,v_1,\dots ,v_l)$ (such a path exits since the graph is finite – the number of vertices is finite).

Now, I want you to notice this fact: every edge that is incident to $v_0$ has to ‘go back’ to the longest path, i.e. it’s second endpoint is in the set $\{v_1,\dots,v_l\}$. Why, because if it woudn’t go back to the path, we will get a longer path, which contradicts $P$ being the longest path.

So we understand that if there is such an edge, it must ‘come back’ to the path. However, if there was an edge $e=\{v_0,u\}$ other than $\{v_0,v_1\}$ we would have get a cycle in the graph which is a contradiction for $G$ being a tree!

Thus, $v_0$ is incident to only one edge: $\{v_0,v_1\}$, then $d(v_0)=1$ and we found a leaf! The same process applies to $v_l$ as well, and we have found two leaves, as required.

Cool, notice that this proof actually gives us some sort of an algorithm to find leaves in a tree – we find the longest path in the tree and take the path’s endpoints. This algorithm is not really efficient, but it is something though…

I want to prove another lemma, which says that if we remove a leaf from a tree with at least two vertices, the sub-graph that we will get, is also a tree.

We denote by $G^\prime$ the graph spanned by the original set of vertices minus the removed leaf – $G^\prime=G[U]$, where $U=V-\{\text{leaf}\}$.

• $G^\prime$ has no cycles, since $G$ has no cycles.
• $G^\prime$ is connected: Let $u,w\in V[G^\prime]$. There is a path between $u,w$ in $G$. This path also appears in $G^\prime$ since it is not possible that is ‘goes through’ the leaf, why? since if it went through the leaf, then the degree of the lead had to be at least 2, which is impossible since it is a leaf.

We have showed that $G^\prime$ has no cycles and is connected, thus $G^\prime$ is a tree!

To end this post, I would like to present 3 equivalent definitions for a tree, and prove that they are indeed equivalent.

Suppose $G=(V,E)$ is a graph with $n$ vertices, the following are equiavilent:

1. $G$ is a tree (connected with no cycles).
2. $G$ is connected and $e(G)=n-1$.
3. $G$ has no cycles and $e(G)=n-1$.

The proofs are really simple and elegant, I really like them, so I shall begin so you will like them too

Let’s start with $(1\Rightarrow 2,3)$. We need to show that a tree has $n-1$ edges. I am going to prove it by induction.

When $n=1$ the graph is just a single vertex, thus, there are no edges at all, then $e(G)=0=1-1=n-1$.

For some general $n$, we will pick a leaf $v$ and remove it. By doing so, we get a new graph – $G^\prime$, we have proved before that $G^\prime$ is also a tree, while it also has $n-1$ vertices. by induction, we know that $e(G^\prime) = (n-1) - 1 = n-2$. Now, since $v$ is a leaf, it is incident to only one edge, thus, when removing $v$ we only ‘lose’ one edge. Therefore, $e(G)=e(G^\prime)+1=(n-2)+1=n-1$ as required.

Now, let’s prove $(2\Rightarrow 1,3)$. Suppose that $G$ is connected with $n-1$ edges, we need to show that it has no cycles.

We will remove one edge from each cycle (think why the graph remains connected) until we get a graph $G^\prime$ with no cycles. $G^\prime$ is a tree with $n$ vertices, we just proved that $e(G^\prime) = n-1$. However, $e(G) = n-1$ as well, thus, we haven’t removed any edge from the graph, therefore, it has no cycles!

Now for the last part, we will show that $(3\Rightarrow 1,2)$. $G$ has no cycles and $n-1$ edges. We need to show that it is connected.

Denote by $C_1,\dots,C_k$ the componets of $G$. Each components is a tree (since it is connected, and the has no cycles) which is spanned by $V(C_i)$. In other words, $G[V(C_i)]$ is a tree. Thus: $e(G[V(C_i)])=|V(C_i)| - 1$. Overall, the number of edges in $G$ is the sum of the number of edges from each component:

e(G)=\sum_{i=1}^ke(V[C_i])=\sum_{i=1}^k(|V(C_i)| - 1)=\sum_{i=1}^k|V(C_i)| - k=n-k

On the other hand, we know that $e(G) = n-1$, thus $n-1 = n-k$ and we get that $k = 1$. This means that there is only one component, therefore, the graph is connected.

## Summary

In this post we made some progress: We have met sub-graphs, trees, forests proved some lemmas, and saw different defintions of trees. I think that’s a good place to stop, then, that’s it for now, see you in the next one!

format: plain


text:
## Usage

animateSpectra(
sim,
species = NULL,
time_range,
wlim = c(NA, NA),
ylim = c(NA, NA),
power = 1,
total = FALSE,
resource = TRUE
)

## Arguments

sim

A MizerSim object

species

Name or vector of names of the species to be plotted. By default all species are plotted.

time_range

The time range to animate over. Either a vector of values or a vector of min and max time. Default is the entire time range of the simulation.

wlim

A numeric vector of length two providing lower and upper limits for the w axis. Use NA to refer to the existing minimum or maximum.

ylim

A numeric vector of length two providing lower and upper limits for the y axis. Use NA to refer to the existing minimum or maximum. Any values below 1e-20 are always cut off.

power

The abundance is plotted as the number density times the weight raised to power. The default power = 1 gives the biomass density, whereas power = 2 gives the biomass density with respect to logarithmic size bins.

total

A boolean value that determines whether the total over all species in the system is plotted as well. Default is FALSE.

resource

A boolean value that determines whether resource is included. Default is TRUE.

## Value

A plotly object

Other plotting functions: plot,MizerSim,missing-method, plotBiomass(), plotDiet(), plotFMort(), plotFeedingLevel(), plotGrowthCurves(), plotPredMort(), plotSpectra(), plotYieldGear(), plotYield(), plotting_functions
# \donttest{


text:
## Calculus (3rd Edition)

$$y'+y=x.$$ (Other examples are possible.)
One example is $$y'+y=x.$$ This an example of a linear, non-separable differential equation.


text:
# Group of order 60

Let $$G$$ be a simple group of order $$60$$:

i) Find the number of Sylow $$3$$- and $$5$$-subgroups of $$G$$.

ii) Show that the alternating group $$A_5$$ has a subgroup of order $$12$$.

iii)Show that $$G$$ is isomorphic to $$A_5$$ if it has a subgroup of order $$12$$.

iv) $$G$$ is isomorphic to $$A_5$$.

I'm stuck at i), iii) and iv):

Let $$s_p$$ denote the number of Sylow p-subgroups of $$G$$:

Because of $$(60=2^2\cdot3\cdot5)$$ I already know that $$G$$ must have Sylow $$3$$- and $$5$$-subgroups and that $$s_3 \in \{1;4;10\}$$ and $$s_5 \in \{1;6\}$$ because of $$(s_3 \mid \text{ord}(G))$$ and $$(s_5 \mid \text{ord}(G))$$ aswell as $$(s_3 \equiv 1 \text{ mod }3)$$ and $$(s_5 \equiv 1 \text{ mod }5)$$.

Is the following sufficient to exclude $$1$$ out of each set:

If $$s_3=1$$ or $$s_5=1$$ there is only one Sylow 3- or 5-subgroup. Because Sylow subgroups are conjugate to only one-another these Sylow 3- and 5-subgroups have to be normal in $$G$$. Contradiction: $$G$$ is simple. It follows that there are more than one Sylow 3- and 5-subgroups.

How would I go about narrowing down these even further?

The fact that $$A_5$$ has a subgroup of order $$12$$ I have already shown.

As for iii) and iv) I don't even know where to begin with. As other proofs of $$G \cong A_5$$ on Stackexchange use "Extended Sylow Theorem", "Burnside Transfer Theorem" and "Strong Cayley Theorem" (probably the same as the first one) I'm quite curious how to prove this without those theorems.

Thanks for checking in! ~Cedric

Yes that is sufficient to rule out $$s_3,s_5 = 1$$. Here's some advice on the points you asked about.
Advice on (i). I'll help you get started on $$s_3$$. First of all, you know $$A_5$$ has $${5 \choose 3} = 10$$ subgroups of order 3, which must be the 3-sylow subgroups, so you probably shouldn't try to prove $$s_3 = 4$$. To prove $$s_3 \neq 4$$, use that $$G$$ acts by conjugation the set $$X$$ of $$p$$-sylow subgroups, which induces a homomorphism $$G \to S_n$$ where $$n = |X|$$. Prove there is no such injection in the case where $$X$$ is the set of 3-sylow subgroups if $$s_3 = 4$$.
Advice on (iii). Try to show that $$G$$ acts transitively on a set of order 5. Where can you find such a set? Hint: the assumption provides one for you!
Advice on (iv). This part is more tricky. At least its clear the problem is to show that $$G$$ has a subgroup of order 12 :) Hint: consider the intersection $$P_2\cap P_2'$$ of a pair of 2-sylow subgroups. What can you say about its normalizer? You should be able to reduce to the case it has size 12 or 20, and then rule out 20 for reasons similar to (i).
• Thanks for your Answer! It's very helpful :) iii) is now done! As for i): I understand that there can't be an injection from $G$ to $S_4$ as $\vert{G}\vert=60 > \vert{S_4}\vert=4!=24$, but how exactly does the conjugation induce this homomorphism and why is it sufficient to show it isn't injective (I guess the last part will follow from the first :P). iv) I'll try next! – C. Brendel Jan 11 at 17:35


text:
Intended for healthcare professionals

CCBYNC Open access
Research

# Physical interventions to interrupt or reduce the spread of respiratory viruses: systematic review

BMJ 2009; 339 (Published 22 September 2009) Cite this as: BMJ 2009;339:b3675
1. Tom Jefferson, researcher1,
2. Chris Del Mar, dean2,
3. Liz Dooley, managing editor, Cochrane Acute Respiratory Infections Group2,
4. Eliana Ferroni, researcher1,
5. Lubna A Al-Ansary, Shaikh Abdullah S Bahamdan research chair4,
7. Mieke L van Driel, professor of general practice 23,
8. Ruth Foxlee, information specialist6,
9. Alessandro Rivetti, information specialist7
1. 1Acute Respiratory Infections Group, Cochrane Collaboration, Rome, Italy
2. 2Faculty of Health Sciences and Medicine, Bond University, Gold Coast, Australia
3. 3Department of General Practice and Primary Health Care, Ghent University, Belgium
4. 4Department of Family and Community Medicine, College of Medicine, King Saud University, Riyadh, Saudi Arabia
5. 5Department of Clinical Pharmacy and King Khalid University Hospital, King Saud University, Riyadh, Saudi Arabia
6. 6Department of Health Sciences, University of York, York
7. 7Cochrane Vaccines Field, Azienda Sanitaria Locale, Alessandria, Italy
1. Correspondence to: T Jefferson, Cochrane Acute Respiratory Infections Group, 00061 Anguillara Sabazia, Rome, Italy jefferson.tom{at}gmail.com
• Accepted 7 September 2009

## Abstract

Objective To review systematically the evidence of effectiveness of physical interventions to interrupt or reduce the spread of respiratory viruses.

Data sources Cochrane Library, Medline, OldMedline, Embase, and CINAHL, without restrictions on language or publication.

Data selection Studies of any intervention to prevent the transmission of respiratory viruses (isolation, quarantine, social distancing, barriers, personal protection, and hygiene). A search of study designs included randomised trials, cohort, case-control, crossover, before and after, and time series studies. After scanning of the titles, abstracts and full text articles as a first filter, a standardised form was used to assess the eligibility of the remainder. Risk of bias of randomised studies was assessed for generation of the allocation sequence, allocation concealment, blinding, and follow-up. Non-randomised studies were assessed for the presence of potential confounders and classified as being at low, medium, or high risk of bias.

Data synthesis 58 papers of 59 studies were included. The quality of the studies was poor for all four randomised controlled trials and most cluster randomised controlled trials; the observational studies were of mixed quality. Meta-analysis of six case-control studies suggested that physical measures are highly effective in preventing the spread of severe acute respiratory syndrome: handwashing more than 10 times daily (odds ratio 0.45, 95% confidence interval 0.36 to 0.57; number needed to treat=4, 95% confidence interval 3.65 to 5.52), wearing masks (0.32, 0.25 to 0.40; NNT=6, 4.54 to 8.03), wearing N95 masks (0.09, 0.03 to 0.30; NNT=3, 2.37 to 4.06), wearing gloves (0.43, 0.29 to 0.65; NNT=5, 4.15 to 15.41), wearing gowns (0.23, 0.14 to 0.37; NNT=5, 3.37 to 7.12), and handwashing, masks, gloves, and gowns combined (0.09, 0.02 to 0.35; NNT=3, 2.66 to 4.97). The combination was also effective in interrupting the spread of influenza within households. The highest quality cluster randomised trials suggested that spread of respiratory viruses can be prevented by hygienic measures in younger children and within households. Evidence that the more uncomfortable and expensive N95 masks were superior to simple surgical masks was limited, but they caused skin irritation. The incremental effect of adding virucidals or antiseptics to normal handwashing to reduce respiratory disease remains uncertain. Global measures, such as screening at entry ports, were not properly evaluated. Evidence was limited for social distancing being effective, especially if related to risk of exposure—that is, the higher the risk the longer the distancing period.

Conclusion Routine long term implementation of some of the measures to interrupt or reduce the spread of respiratory viruses might be difficult. However, many simple and low cost interventions reduce the transmission of epidemic respiratory viruses. More resources should be invested into studying which physical interventions are the most effective, flexible, and cost effective means of minimising the impact of acute respiratory tract infections.

## Introduction

Epidemic and pandemic new viral infections pose a serious threat worldwide. Several have occurred recently, including the current H1N1 pandemic influenza1 and the coronavirus outbreak that caused severe acute respiratory syndrome (SARS).2

Even non-epidemic acute respiratory tract infections place a serious burden on health and healthcare systems. Overall, epidemics account for most of the 7% of total deaths from respiratory tract infections in the world.3 Our 2007 Cochrane review showed that physical interventions (personal hygiene, barriers, and distancing) are highly effective.4 However, the current mainstay of pandemic interventions still seems to be vaccines and antiviral drugs, with no evidence supporting their widespread use,5 6 7 8 9 10 especially against a seemingly mild threat such as the novel H1N1 virus. For example, in the most recent guidance document on planning for pandemic influenza from the World Health Organization, handwashing and masks were mentioned only twice and gloves and gowns once each, but vaccines and antivirals were cited 24 and 18 times, respectively.11

We carried out a systematic review to update our 2007 Cochrane review on the evidence of the effectiveness of public health measures such as isolation, distancing, and barriers to interrupt or reduce the spread of respiratory viruses.

## Methods

We considered trials (individual level or cluster randomised, or quasi-randomised), observational studies (cohort and case-control designs), and any other comparative design, carried out in people of all ages and provided that some attempt had been made to control for confounding. We included any intervention to prevent the transmission of respiratory viruses from animal to human or from human to human (isolation, quarantine, social distancing, barriers, personal protection, or hygiene) compared with no intervention (“do nothing”) or another intervention. We excluded vaccines and antivirals.

Outcome measures were mortality, numbers of cases of viral illness, the severity of viral illness, or proxies for any of these, and other measures of disease burden (such as admissions to hospital).

### Search strategy

We searched the Cochrane Central Register of Controlled Trials (Cochrane Library 2009, issue 2), Medline (1966 to May week 1 2009), OldMedline (1950 to 1965), Embase (1990 to Week 18, 2009), and CINAHL (1982 to May week 1 2009); see the web extra on bmj.com for the search terms used for Medline and the Cochrane Register of Controlled Trials (modified for OldMedline, Embase, and CINAHL). No language restrictions were applied. Filters for study design included trials, cohort, case-control and crossover studies, before and after, and time series. We scanned the references of included studies for other potentially relevant studies. When necessary we corresponded with the first authors of studies to elicit further information.

We scanned the titles and abstracts of the studies identified by our search. When a study seemed to meet our eligibility criteria or information was insufficient to exclude it, we obtained the full text articles. We used a standardised form to assess the eligibility of each study, on the basis of the full article.

### Quality assessment

We analysed randomised and non-randomised studies separately. Risk of bias in the randomised studies was assessed for the method of randomisation, generation of the allocation sequence, allocation concealment, blinding, and follow-up. Non-randomised studies were assessed for the presence of potential confounders using the appropriate Newcastle-Ottawa scales12 for case-control and cohort studies, and a three point checklist for controlled before and after and ecological studies.13

We assigned categories for risk of bias on the basis of the number of items judged inadequate in each study: up to one inadequate item represented a low risk of bias, up to three items a medium risk, and more than three items a high risk.

### Data extraction

Two authors (TOJ, CDM) independently applied the inclusion criteria to all identified and retrieved articles. Three authors (EF, LA, GB) extracted data from the included studies and checked their accuracy on standard forms used by the Cochrane Vaccines Field, supervised and arbitrated by TOJ and CDM.

Aggregation of data depended on the study design, types of comparisons, sensitivity, and homogeneity of definitions of exposure, populations, and outcomes used. We calculated the I2 statistic for each pooled estimate to assess the impact of statistical heterogeneity.14 15

When possible we carried out a quantitative analysis and summarised effectiveness as an odds ratio, with 95% confidence intervals. When a result was significant we calculated absolute intervention effectiveness as a percentage using the formula: intervention effectiveness=1−odds ratio. In studies that could not be pooled we used effect measures as reported by the authors—for example, risk ratios or incidence rate ratios, with 95% confidence intervals or, when not available, P values.

## Results

Of a total 2958 potentially relevant studies scanned for the 2007 review and its 2009 update, 2790 were excluded on the basis of their titles or abstracts, and the full papers of the remaining 168 trials were retrieved. Fifty eight papers of 59 studies were finally included (table 1); eight of these studies were incorporated in the 2009 update. A list of excluded studies will be available in the published Cochrane update.

Table 1

Overview of results of physical interventions and types of evidence to interrupt or reduce the spread of respiratory viruses

View this table:

The quality of the included randomised controlled trials varied (see web extra table). Three of the four trials were poorly reported, with two papers (three studies) giving no description of the randomisation sequence, allocation, or allocation concealment.16 17 One trial reported the generation of randomisation, but blinding was impossible owing to the nature of the intervention (gargling with water with or without povidone-iodine compared with standard gargling with no attempt to mask the taste of iodine).18 Information provided in a subsequent brief report contradicted the original report.19 The design of the two trials was artificial and therefore the results were not generalisable to daily practice.17

The quality of the cluster randomised trials varied (see web extra table). Only the highest quality trials20 21 22 29 reported cluster coefficients and carried out analysis of data by unit of (cluster) randomisation. Other common problems were a lack of description of randomisation procedures, partial reporting of outcomes, unclear numerators or denominators, unexplained attrition,23 24 25 26 and complete failure of double blinding27 or inappropriate choice of placebo.28 Two cluster randomised trials involving the use of face masks29 30 by contacts of patients with influenza and influenza-like illness had poor compliance. This illustrates the difficulty of using bulky equipment in clinical trials in the absence of a real threat. In one trial the intervention targeted (randomised) clusters comprising households of index patients with influenza, up to three days after the onset of symptoms in the index case.29 This almost certainly underestimates the effect of the interventions, given that influenza infectivity is highest soon after infection. Another study was underpowered to detect differences in effect between different types of masks.30 A further cluster randomised trial was rated as being at low risk of bias owing to careful evaluation of compliance in the intervention arm (hand sanitiser wipes and disinfection of surfaces).31

Five of the seven case-control studies had a medium risk of bias32 33 34 35 36 and two a low risk,37 38 mostly because of inconsistencies in the text and lack of adequate description of controls (see web extra table). Six of the 16 prospective cohort studies had a low risk of bias,39 40 41 42 43 44 six a medium risk,45 46 47 48 49 50 and three a high risk (see web extra table).51 52 53 One was a brief report of a small study with insufficient details to allow assessment.54 All five retrospective cohort studies had a high risk of bias (see web extra table).55 56 57 58 59 Six of the 13 controlled before and after studies had a low risk of bias,60 61 62 63 64 65 two a medium risk,66 67 and five a high risk (see web extra table).68 69 70 71 72 Many of the observational studies were poorly reported and the retrospective designs were prone to recall bias. The most common problem in all of these studies, however, was that circulation of the virus within the reference population was not reported, questioning the interpretation and generalisability of the conclusions.

### Reported results from randomised studies

#### Handwashing with or without antiseptics

Three randomised controlled trials tested the effects of cleaning hands on inactivating the virus and preventing experimental colds due to rhinovirus. This resulted either in a reduction in the incidence of rhinovirus infection among volunteers using different combinations of acids for cleaning (P=0.025)17 or did not reach statistical significance (13% v 30% with combined denominator of only 60).17 When iodine treatment of the fingers was used, one of 10 volunteers in the intervention arm became infected compared with six of 10 in the placebo arm (P=0.06, Fisher’s exact test).16

Eight cluster randomised studies tested educational programmes to promote handwashing with or without antiseptic agents on the incidence of acute respiratory tract infections either in schools or in households. As a result of different definitions, comparisons, lack of reporting of cluster coefficients, and, in two cases, missing data for participants,23 24 meta-analysis was not feasible. Three of the trials reported a lack of effect for the prevention of acute respiratory illness: risk ratios 0.94 (95% confidence interval 0.66 to 2.43),24 0.97 (0.72 to 1.30),22 and 1.10 (0.97 to 1.24).31 A possible explanation for the lack of effect is that because exposure to respiratory viruses is ubiquitous, repeated hand hygiene would be needed, which is not practical in busy settings such as schools. Nevertheless, the highest quality trials reported a significant decrease in respiratory illness in children aged up to 24 months (risk ratio 0.90, 0.83 to 0.97), although the decrease was not significant in older children (0.95, 0.89 to 1.01),21 and a 50% (−65% to −34%) lower incidence of pneumonia in children aged less than 5 years in a low income country.20 Another study reported a decrease in respiratory tract infections of up to 38% with additional hand rubbing with benzalkonium chloride (risk ratios 0.69 for incidence of absence due to illness and 0.71 for duration of absence).26 One study reported a 43% reduction in absenteeism from school with the use of alcohol gel in addition to handwashing.25 Repeated handwashing significantly reduced the incidence of colds by as much as 20% in two trials.23 73

#### Impregnated disposable handkerchiefs

Three cluster randomised studies tested the effects of disposable handkerchiefs impregnated with virucide on the incidence and spread of acute respiratory tract infections. One study reported a reduced incidence from 14% to 5% in households over 26 weeks.27 A similar study reported a small non-significant (5%) decrease across families.27 However, as the reduction in incidence was confined to primary illness, which would be unaffected by use of the tissues, it might be assumed that the tissues were ineffective. A community trial also reported a non-significant reduction in secondary attack rates of acute respiratory tract infection (18.7% v 11.8%) during high circulation of influenza H3N2 and rhinoviruses in the community.28 This result is likely to be an underestimate because of the barrier effect of the untreated tissue wipes used as control.

#### Gargling

One trial from Japan tested the effects of gargling with water compared with gargling with povidone-iodine or gargling as usual.18 This trial is linked by its registration number to a subsequent short report19 and the reporting of the two is confusing. The authors suggest that gargling with water is effective against mild forms of acute respiratory tract infection but not the more severe forms. The incidence rate ratio for gargling with water was 0.64 (95% confidence interval 0.41 to 0.99) and for gargling with povidone-iodine was 0.89 (0.60 to 1.33). The authors also found that gargling with water may attenuate the symptoms of the disease. Gargling with povidone-iodine seemed to affect compliance because two participants switched to using water. Perhaps this potentially important study, totalling 387 participants in three arms, should be repeated in a larger population and with clearer reporting.

Two cluster randomised trials assessed the effects on transmission of wearing face masks. In one study carried out in Hong Kong29 face masks were worn after a rapid diagnosis for influenza. Households of the index case were randomised to wearing face masks plus education, handwashing with alcohol sanitiser soap plus education, or education on illness prevention (control group). Surgical face masks were worn by all household members when the index patient was at home. The authors concluded that if face masks plus hand hygiene were implemented within 36 hours of the onset of symptoms in the index patient, then the transmission of influenza was significantly decreased (adjusted odds ratio 0.33, 95% confidence interval 0.13 to 0.87). This is likely to be an underestimate of the effect because of the study design.

An Australian trial carried out over two winters assessed the effect of surgical masks, P2 masks, or no masks on the prevention of influenza-like illness and influenza in households.30 Although the intention to treat analysis showed no effect, sensitivity analysis showed that adherence to use of P2 or surgical masks significantly reduced the risk of influenza-like illness (hazard ratio 0.26, 95% confidence interval 0.09 to 0.77). Under the assumption that the incubation period is equal to one day (the most probable value for the two most common viruses isolated, influenza n=21 and rhinovirus n=26), adherence to the use of P2 or surgical masks significantly reduced the risk of influenza-like illness, with a hazard ratio of 0.26 (0.09 to 0.77; P=0.015). However, compliance with respirator use in a family setting is expected to be poor unless there is a clear impending risk.

### Reported results from case-control studies

Six of the seven case-control studies assessed the impact of public health measures to curb the spread of severe acute respiratory syndrome during February to June 2003 in China, Singapore, and Vietnam. Homogeneity of case definition, agent, settings, and outcomes allowed meta-analysis (table 2, figure). Binary data were pooled; as none of the comparisons showed significant heterogeneity, a fixed effects model was used. Although continuous data were often available, the variables were different and measured in different units, with standard deviations usually missing, which made meta-analysis impossible. Studies reported that disinfection of living quarters was highly effective in preventing the spread of severe acute respiratory syndrome (odds ratio 0.30, 95% confidence interval 0.23 to 0.39)32; handwashing for a minimum of 11 times daily prevented most cases (0.45, 0.36 to 0.57; all six studies),32 33 34 35 37 38 wearing simple masks was highly effective (0.32, 0.25 to 0.40; five studies),32 33 34 35 38 wearing N95 masks was even more effective (0.09, 0.03 to 0.30; two studies)33 37, wearing gloves was effective (0.43, 0.29 to 0.65; three studies),33 35 37 wearing gowns was also effective (0.23, 0.14 to 0.37; four studies),33 35 37 38 and all approaches combined achieved high effectiveness (0.09, 0.02 to 0.35; two studies).33 37 All studies selected cases from hospitals, except one32 which chose cases of probable severe acute respiratory syndrome reported to the Department of Health in Hong Kong. A seventh case-control study36 assessed the impact of environmental, administrative, and host factors in 86 wards in 21 hospitals in Guangzhou and 38 wards in five hospitals in Hong Kong during the severe acute respiratory syndrome pandemic. Six significant risk factors were identified: minimum distance between beds of 1 m or less (odds ratio 6.94, 1.68 to 28.75), availability of washing or changing facilities for staff (0.12, 0.02 to 0.97), whether resuscitation was ever done on the ward (3.81, 1.04 to 13.87), whether staff worked while they had symptoms (10.55, 2.28 to 48.87), whether any index patient or the first patient with severe acute respiratory syndrome admitted to a ward required oxygen therapy (4.30, 1.00 to 18.43), and whether any index patients required bilevel positive airway pressure ventilation (11.82, 1.97 to 70.80).

Table 2

Pooled estimates of effect from case-control studies of public health interventions to interrupt the transmission of severe acute respiratory syndrome

View this table:

Effect of frequent handwashing or wearing masks, gloves, or gowns on prevention of cases of severe acute respiratory syndrome

### Prospective cohort studies

#### Handwashing with or without antiseptics

Using an alcohol rub in students’ communal residences resulted in significantly fewer symptoms (reductions of 14.8% to 39.9%) and lower absenteeism (40% reduction).47 In a much cited small experimental study, virucidal paper handkerchiefs containing citric acid interrupted the transmission of colds caused by rhinovirus and transmitted through playing cards: 42% of students allocated to reusable cotton handkerchiefs developed colds compared with none using the disposable virucidal tissues.40 Few studies reported interventions in the day care setting, either in staff or patients. Perhaps more than the addition of portable virucidal hand foam as an adjunct to handwashing, one educational programme on handwashing for staff of a day care centre for adults was effective in reducing rates of respiratory tract infection from 14.5-10.4 per 100 person months to 5.7 (P<0.001), with an accompanying decline in viral isolates.41 This confirmed an earlier report on the effectiveness of a handwashing programme in reducing absenteeism due to influenza-like illness in a primary school.46

Two studies with a high risk of bias reported on the effectiveness of education, a handwashing routine, and education of kindergarten children, parents, and staff in correct sneezing and coughing procedures, although the incidence of infections in the control and test centres fluctuated considerably.51 The programme was not, however, effective in reducing absenteeism due to acute respiratory tract infections (risk ratio 0.79, P=0.756).52

A prospective cluster open label crossover cohort study assessed the effectiveness of a hand sanitiser in conjunction with handwashing at will using soap and water in a private elementary school in California. Use of the sanitiser was associated with a reduction in absenteeism due to illness by 41.9% (reduction in respiratory illnesses of 49.7% over the 10 weeks of the study).45 An education programme on infection control that reinforced handwashing and other hygiene measures in a nosocomial setting was associated with a reduction in the number of organisms present on hands and surfaces and of acute respiratory tract infections, whereas the tabulated data suggested the opposite (incidence rate 4.15 per 1000 patient days in the test homes v 3.15 in the control homes).50

#### Goggles and masks with or without triage

A study found that wearing a goggle and mask apparatus was effective in healthcare workers visiting and caring for children aged up to 5 years with respiratory syncytial virus and symptoms of respiratory tract disease (5% illness rate in goggle wearers v 61% in no goggle controls).39 Rapid laboratory diagnosis, cohort nursing, and wearing gowns and gloves for all contacts of children infected with respiratory syncytial virus significantly reduced the risk of nosocomial respiratory syncytial virus infection (odds ratio 0.013 to 0.76).43 But another similar study reported no effect of adding both gowns and masks to the usual handwashing routine on the development of illness in staff caring for infants with respiratory tract disease (4/30 in the handwashing group v 5/28 in the handwashing, gown, and mask group, P>0.20) possibly due to the described poor compliance with the barrier protocol.47 Strict procedures of triage and infection control to stop transmission of severe acute respiratory syndrome from infected children to carers and visitors of a large hospital at the height of the epidemic in 2003 in Hong Kong was effective as no healthcare worker became ill, in contrast with experiences in other institutions.42 A small study comparing the N95 mask with paper surgical masks in volunteers found that surgical masks, even when worn in multiple layers (up to five), filtered ambient particles poorly.54 This principle was confirmed in another small study of air filtration to prevent the spread of droplets.44

#### Distancing

One study carried out during the severe acute respiratory syndrome pandemic in Taiwan assessed the effects of two types of quarantine: level A (after close exposure to people with severe acute respiratory syndrome) and level B (travellers who sat within three rows of someone infected with severe acute respiratory syndrome on a plane or were returning from WHO designated areas affected by severe acute respiratory syndrome).53 The odds ratio for developing severe acute respiratory syndrome with level A quarantine was 2.7 and with level B quarantine was 10.5. The probability of contracting severe acute respiratory syndrome differed in those aged less than 20 years (0.09% for level A quarantine v 0.02% for level B quarantine). The authors concluded that by placing only those with known exposure to someone with severe acute respiratory syndrome in quarantine the number of people quarantined could have been reduced. The characteristics (length and circumstances) of each type of quarantine were not, however, described.

One study49 took place in a US training facility for military recruits. It aimed to test whether contact with people entering the recruits’ units affected the rate of influenza-like illness and to disentangle the role of environmental and person to person factors in transmission. The study compared the incidence of influenza-like illness in closed and open units depending on the ease of access by contagious (convalescent) people. The authors found no difference in incidence but extensive sampling of facilities that had been empty for a month showed persistence of adenovirus 4 (the main agent of influenza-like illness at the time in the community and the only agent tested for). This suggests a powerful influence of environmental factors in the pathogenesis of influenza-like illness, with a reduced role of person to person spread.

### Retrospective cohort studies

#### Distancing

Two retrospective cohort studies investigated isolating children aged less than 3 years with suspected respiratory syncytial virus. Transmission was diminished by “up to 60%” in one study56 but not in the other.55 Isolation of cases during the 2003 severe acute respiratory syndrome epidemic in China was reported to limit transmission only to those who had contact at home or in hospital with a patient showing symptoms of severe acute respiratory syndrome (attack rates for carers 31%, 95% confidence interval 20% to 44%; for visitors 9%, 3% to 22%; for those living with someone with severe acute respiratory syndrome 5%, 3% to 9%) but not to contacts living in the same building, working with cases, or having no contact with cases during the incubation period. This suggests that quarantine should be extended only for contacts of patients with symptoms of severe acute respiratory syndrome.57 Another brief report carried out in 2003 during the epidemic in a military hospital in Taiwan and 86 control hospitals, compared an integrated infection control policy to protect against infection with normal isolation procedures; only two healthcare workers from the military hospital became infected with severe acute respiratory syndrome compared with 43 suspected and 50 probable cases in the control hospitals.58

#### Harms of personal protective equipment

A study of healthcare workers assessed possible harms caused by the use of personal protective equipment during the severe acute respiratory syndrome pandemic.59 Survey results showed that acne, itch, and rash were the most common harms reported after wearing a N95 mask (60%, 51%, and 36%) and that dry skin, itch, and rash were reported by glove users (73%, 56%, and 38%). Other harms were reported by small numbers of users. This study, although retrospective, is important as it points to reasons for poor compliance with barrier interventions.

## Discussion

Physical interventions are highly effective against the spread of a broad range of respiratory viruses.

Before drawing generalisations from the studies in our systematic review, however, we need to consider several features. The settings of the studies, carried out over four decades, were heterogeneous, ranging from suburban schools23 45 51 70 to military barracks,49 64 intensive care units, and paediatric wards61 68 in high income countries; slums in low income countries20; family units in China29; travellers in Taiwan53; and day care centres for children with special needs with a high teacher to pupil ratio.71 Few attempts were made to obtain socioeconomic diversity—for example, by involving more schools in the evaluations of the same programme.45 We were able to identify few studies from low income countries, where the highest burden lies and where cheap interventions are so critical. Even in high income countries, such as Israel, the dramatic reduction in acute respiratory tract infections subsequent to school closure may have been related to the country’s large child population (34%). Limited availability of over the counter drugs and national universal comprehensive health insurance with consequent doctor prescribed symptomatic treatment may further limit the generalisability of the findings.70

### Limitations of the evidence

The quality of the methods varied in these studies but may reflect the difficult and real life circumstances in which they were carried out. Hasty design of interventions for public health crises, particularly the six case-control studies of severe acute respiratory syndrome, is understandable but less so when no randomisation (not even by cluster) was carried out in several unhurried cohort and before and after studies. Randomisation could often have involved minimal disruption to the delivery of services. Inadequate reporting made interpretation of before and after studies difficult. In the trials a considerable loss of information resulted from incomplete or no reporting of randomisation,17 blinding,27 numerators and denominators,23 24 interventions, outcomes,48 participant attrition,50 confidence intervals,43 and cluster coefficients.23 Potential biases (such as cash incentives for participants48) were not discussed. Some authors seemed to confuse cohort designs with those of before and after designs, which elaborated conclusions unsupported by their data.50

Methodological quality was sometimes eroded by the need to deliver behavioural interventions in the midst of service delivery.51 None the less, even when suboptimal designs were selected, trial authors rarely attempted to articulate potential confounders. A commonly ignored confounder specific to this area was the huge variability in incidence of viruses.56 70 Sometimes this was tackled in the study design,41 even in controlled before and after studies (one study attempted to correlate admissions for respiratory syncytial virus with circulating respiratory syncytial virus in the community).66 One pilot study was carried out during a period of low viral circulation in the northern hemisphere (early summer), whereas the subsequent full study was carried out from January to September.29

Another study attempted to link exposure (measured as nasal excretions) and infection rate in the periods before and after intervention.61 Inappropriate placebos caused design problems. In some studies the placebo probably carried sufficient effect to dilute the intervention effects.28 Two attempts probably failed because placebo handkerchiefs were impregnated with a dummy compound that stung the users’ nostrils.27 Some studies used impractical interventions. Volunteers subjected to the intervention hand cleaner (organic acids) were not allowed to use their hands between cleaning and virus challenge, so the effect of normal use of the hands on the intervention remains unknown.17 Although 2% aqueous iodine is a successful antiviral intervention when painted on the hands it causes cosmetic staining and is impractical for all but those at the highest risk of epidemic contagion.16 Compliance with interventions, especially with educational programmes and N95 masks, was a problem in several studies. N95 masks also caused harm such as rash and acne, further limiting the compliance of healthcare workers.59 Routine long term implementation of some of the measures assessed in this review would be problematic, particularly maintaining strict hygiene and barrier routines for long periods. In the absence of a real threat of a serious epidemic, this would probably be feasible only in highly motivated environments, such as hospitals. Most of the study authors commented on the considerable logistic burden imposed by barrier routines at the community level.

### Clear benefits

The highest quality cluster randomised trials indicate that most effect on preventing the spread of respiratory viruses can be expected from hygienic measures in younger children and household members of index cases. Perhaps this is because younger children are least capable of hygienic behaviour and have longer lived infections and greater social contact, thereby acting as portals of infection into the household.21 Additional benefit from reduced transmission from children to other members of the household is broadly supported by the results of other study designs where the potential for confounding is greater. The seven case-control studies suggest that implementing barriers to transmission, isolation, and hygienic measures are effective with the use of relatively cheap interventions to contain epidemics of respiratory viruses. We found limited evidence of the superior effectiveness of barrier devices to droplets such as the N95 masks over simple surgical masks. N95 masks are respirators with 95% filtration capability against non-oily particulate aerosols.38 Although they are more expensive and uncomfortable (especially if worn for long periods) than simple surgical masks, they may be useful in high risk situations. We are aware of at least one randomised trial comparing different masks for influenza (NCT00756574) .

### Uncertainties

It is uncertain whether the incremental effect of adding virucidals or antiseptics to normal handwashing actually decreased the burden of respiratory tract disease outside the confines of the rather atypical studies reported on here. The extra benefit may have been, at least in part, accrued by confounding additional routines. Studies preventing transmission of respiratory syncytial virus and similar viruses seemed to be closer to real life and suggest good effectiveness of physical barriers. However, concerns about the methodological quality of the controlled before and after studies suggest that the benefits may have been caused by differences in the populations, especially in virus infection rates. These were poorly reported in most studies. The effectiveness of gargling with water compared with an antiseptic should be tested further in a larger trial with better masking of the possible addition of the antiseptic liquid.

The lack of proper evaluation of global and highly resource intensive measures such as screening at entry ports and social distancing was disappointing. The handful of studies (mostly done during the severe acute respiratory syndrome epidemic) does not allow any firm conclusions. Encouragingly, differential quarantine periods based on length and intensity of exposure may have minimised the transmission of severe acute respiratory syndrome. This observation should be tested further when possible.

We would like to emphasise the potential importance of one study, that in the US military training facility, which suggests that as yet unknown environmental factors may be powerful stimuli in the genesis of influenza-like illness and that person to person spread may be a limited form of transmission.49

### Policy and evidence

The disparity in effectiveness between the high profile of influenza vaccines and antivirals and the low profile of physical interventions is striking. Public health recommendations are almost completely based on the use of vaccines and antivirals despite the lack of strong evidence.1 Vaccines work best in those who are universally considered least to need them10—namely, healthy adults. Antivirals may be harmful and their benefits depend on the identification of the agent (influenza).8 But physical interventions are effective, safe, flexible, universally applicable, and relatively cheap. There are many complex reasons for this disparity. Influenza vaccines, for instance, target only a limited proportion of influenza-like illnesses (around 10% to 7%).7 8 The comparative rarity of influenza as a cause of influenza-like illness affects the calculation of the effectiveness of influenza specific vaccines and antivirals. If the incidence of influenza in the unvaccinated population is low then the vaccine effectiveness ratio will be close to 1 and effectiveness low. However, physical interventions are directed against all viral diseases and therefore calculation of their effectiveness is sensitive only to the incidence of influenza-like illness, not of influenza. In addition, physical interventions are relatively cheap. The cost of masks ranges from $0.16 (£0.09; €0.11) to$1.9 each depending on make and complexity, from soft surgical masks to N95 masks.74 Prices are higher for well known brands and different designs and materials, although bulk purchase would result in sizeable discounts.

Our review shows that public health measures can be highly effective, especially when they are part of a structured programme that includes instruction and education and when they are delivered together.

### Implementation of physical interventions

One major problem with physical interventions is poor compliance, especially during periods of low threat as reported in many of the included studies. All the mentioned physical interventions require change in behaviour, which is the most important barrier to implementation. A need exists to further research, introduce, and evaluate such programmes aimed at changing behaviour. Extra resources should be made available for these. Further large scale pragmatic trials to evaluate the best combinations are clearly required. Funding for these studies remains a problem, however. Randomised controlled trials with a pragmatic design, similar to the trial by Luby et al,20 should be carried out whenever possible. Perhaps the impressive effect of hygienic measures aimed at younger children is based on their poor capability of being hygienic. Although physical interventions are cheap and effective, their cost effectiveness should be evaluated in prospective studies. The role of environmental factors in the genesis of acute respiratory tract infections should be investigated further.

### Conclusions

Based on the findings of this review, we recommend that handwashing programmes should be implemented nationwide, their effectiveness monitored, and their cost effectiveness evaluated. In situations of high risk of transmission, barrier measures should be implemented such as wearing gloves, gowns, and masks with a filtration apparatus, and isolation of likely cases. Most effort should be concentrated on reducing transmission from young children through regular education at school on hygiene. In addition, society should invest in more comfortable and better designed face masks and barrier apparatus, which would increase compliance with their use.

#### What is already known on this topic

• Respiratory tract infection is the main cause of burden of disease worldwide

• The world is increasingly concerned about pandemics of viral origin

• Interventions to minimise the spread of infection focus on influenza specific vaccines and stockpiling of antivirals

• Hygiene and physical barriers, especially handwashing, wearing masks, and isolation of potentially infected patients, are effective in preventing the spread of viral infections

• These interventions should be given higher priority in the preparation and evaluation of national pandemics

• Cheap and non-invasive interventions have the potential to reduce mortality and morbidity from viral respiratory tract infections

## Notes

Cite this as: BMJ 2009;339:b3675

## Footnotes

• We thank Anne Lyddiatt, Stephanie Kondos, Tom Sandora, Kathryn Glass, Max Bulsara, Rick Shoemaker, Allen Cheng, Bill Hewak, Adi Prabhala, and Sree Nair for their comments on or contributions to present and previous versions of the review; Jørgen Lous for translating a Danish paper and extracting data; Ryuki Kassai for translating a Japanese paper; Taixiang Wu for translating several Chinese papers; Luca De Fiore for supplying information on costs; and Michael Broderick for supplementary study information. LAA-A holds the Shaikh Abdullah S Bahamdan research chair for evidence based health care and knowledge translation at the College of Medicine, King Saud University, Riyadh, Saudi Arabia.

• Contributors: TOJ, CDM, and LD drafted the protocol. LD, CDM, MVD, and TOJ edited the text of the previous version. RF and AR constructed and ran the search strategy. EF, LA and GAB extracted the data. TOJ, CDM, and MVD checked the data and wrote the final report. All authors contributed to the final report.

• Funding: NHS research and development programme and National Health and Medical Research Council of Australia. The study sponsor had no role in study design, analysis, conclusions, drafting the report, or the decision to submit the report.

• Competing interests: None declared.

• Ethical approval: Not required.

This is an open-access article distributed under the terms of the Creative Commons Attribution Non-commercial License, which permits use, distribution, and reproduction in any medium, provided the original work is properly cited, the use is non commercial and is otherwise in compliance with the license. See: http://creativecommons.org/licenses/by-nc/2.0/ and http://creativecommons.org/licenses/by-nc/2.0/legalcode.

View Abstract


text:
# Shannon Switching Game on Vertices (Hex)

Blue and Red alternate in coloring the vertices of a graph $G$. Blue wants to connect two distinguished vertices $s,t$ of $G$ with a blue path. Red wants to select a $s$-$t$ vertex-cut.

## Description

Given a connected graph $G=(V,E)$ and two distinct vertices $s,t \in V$, two players blue and red take turns in coloring an uncolored vertex in $V \setminus \{ s, t \}$ of their respective color. Initially all the vertices are uncolored. Blue wins if the set of blue vertices contains a path from a neighbor of $s$ to a neighbor of $t$. Red wins if every path from $s$ to $t$ contains at least one red vertex, i.e., if the red vertices form a $s$-$t$ vertex-cut.

Hex is a popular special case of this game that is played by coloring the hexagons of a rhombus-shaped hexagonal grid. Two opposing sides of the grid are blue, while the remaining two sides are red. Blue (resp. red) wins by connecting the two blue (resp. red) sides with a blue (resp. red), where two hexagons are considered adjacent if they share an edge.

An instance of Hex can be thought as an instance of the Shannon switching game on vertices in which the vertices in $V \setminus \{s, t\}$ are the hexagons in the grid, and $s$ and $t$ are adjacent to all the hexagons on the two opposing blue sides, respectively.

The classical version of Hex, shown in the picture, is played on a $11 \times 11$ grid.

## Computational complexity

The game cannot end in a draw: if all the vertices are colored and there is no blue path from $s$ to $t$, then there is a red $s$-$t$ vertex cut.

In a final configuration of Hex there is either blue or a red path connecting the sides of the grid having the corresponding color [1]. A strategy stealing argument shows that, in Hex, the first player to move has a winning strategy. [2]

In the Misère version of Hex (the first player to connect their two sides with a path of their color loses) the first player has a winning strategy on $n \times n$ rhombus shaped grids when $n$ is even, and the second player has a winning strategy when $n$ is odd. [4]

It is PSPACE-complete to decide whether a player has a winning strategy in the Shannon switching game on vertices [3], even on planar graphs [5].

## Notes

The version of the game in which edges are colored instead of vertices is known as Shannon Switching Game.

## References

[1] David Gale, “The Game of Hex and Brouwer Fixed-Point Theorem”, The American Mathematical Monthly, 1979.

[2] Martin Gardner, “Hexaflexagons and Other Mathematical Diversions: The First Scientific American Book of Puzzles and Games”, 1988.

[3] S. Even, R. E. Tarjan, “A combinatorial problem which is complete in polynomial space”, in STOC 1975.

[4] R. B.Haywarda, B. Toft, P. Henderson, “How to play Reverse Hex”, Discrete Mathematics, 2012.

[5] S. Reisch, “Hex ist PSPACE-vollständig”, Acta Informatica, 1981.

@misc{cog:shannon-switching-game-on-vertices,
author = "{CoG contributors}",
title  = "{Shannon Switching Game on Vertices (Hex) --- Complexity of Games}",
year   = "2021",
url    = "https://www.isnphard.com/i/shannon-switching-game-on-vertices/",
note   = "[Online; accessed 2021-05-03]"
}


text:
# Calculate a Binomial Confidence Interval in R (3 Examples)

In this article you’ll learn how to calculate a binomial confidence interval in the R programming language.

We can calculate a binomial confidence interval using this formula:

$$p \pm z\times\sqrt{\frac{p\times(1-p)}{n}}$$

Being,

n: the sample size of our population
p: the proportion of cases of success
z: the z-value we choose

The table of content is structured as follows:

Let’s see how this can be done.

## Data Sample

For this tutorial, we will need to create some example data:

x <- 45 # Number of successes n <- 100 # Sample size

As you can see above, we have defined two variables in order to calculate the confidence interval. Now, we are ready to see the three different examples we can use in order to calculate the confidence intervals.

## Example 1: Calculate Binomial Confidence Interval Using the binconf() Function

In order to use the binconf() function, please install the Hmisc package if you haven’t installed it yet. You just have to run the following command:

install.packages("Hmisc")

If you had already installed the “Hmisc” package before, you can skip the previous step. Just load the package before using the function:

library(Hmisc) binconf(x, n, alpha=.05)

We have calculated the confidence interval with a confidence level of 95%, and that’s why alpha value equals to .05, but we can change this value depending on the confidence level we want to use.

Thus, the 95% confidence interval for the sample data we are using is [0.3561,0.5475].

## Example 2: Calculate Binomial Confidence Interval Using the prop.test() Function

Another example to calculate the 95% binomial confidence interval is using the prop.test() function.

prop.test(x,n,conf.level=.95,correct=FALSE)

As shown, the confidence interval we obtain using the prop.test() function matches the one calculated with the previous method.

## Example 3: Calculate Binomial Confidence Interval Manually

We can also calculate the confidence interval manually. In order to accomplish this, first we need to define the proportion and the significance level.

p <- x / n # Calculate the proportion a <- 0.05 # Define the significance level

Now, we define the function in order to calculate our interval. For this, we can use the qnorm and sqrt functions:

p + c(-qnorm(1-a/2),qnorm(1-a/2)) * sqrt((1/100)*p*(1-p))

The output we obtain when we calculate the confidence interval manually is the same as when we calculate it using the binconf() or prop.test() functions.

## Video, Further Resources & Summary

Do you need more explanations on how to calculate confidence intervals in R? Then you should have a look at the following YouTube video of the Statistics Globe YouTube channel.

Furthermore, you could have a look at some of the other tutorials on Statistics Globe:

This post shows how to calculate a binomial confidence interval in R. In case you have further questions, you may leave a comment below.

Subscribe to the Statistics Globe Newsletter