# filterGraph

##### Filter graph to remove vertices that are not well connected

Vertices not part of the largest connected component are excluded.
Vertices that have fewer than `minAny`

edges and are not
connected to `minDifferent`

or more different vertices are
excluded. For example, vertex ‘a’ connected to vertices
‘b’ and ‘c’ will be include so long as these vertices
are part of the largest connected component.

##### Usage

`filterGraph(df, minAny = 11L, minDifferent = 2L)`

##### Arguments

- df
a data frame with pairs of vertices given in columns

`pa1`

and`pa2`

, and item response data in other columns- minAny
the minimum number of edges

- minDifferent
the minimum number of vertices

##### Details

Given that `minDifferent`

defaults to 2,
if activity \(A\) was compared to at least
two other activities, \(B\) and \(C\), then \(A\) is retained.
The rationale is that,
although little may be learned about \(A\),
there may be a transitive relationship,
such as \(B < A < C\), by which the model can infer that \(B < C\).
Therefore, per-activity sample size is less of a concern
when the graph is densely connected.

A young novice asked the wise master, "Why is 11 the default `minAny`

instead of 10?"
The master answered, "Because 11 is a prime number."

##### Value

The same graph excluding some vertices.

##### Examples

```
# NOT RUN {
df <- filterGraph(phyActFlowPropensity[,c(paste0('pa',1:2),'predict')])
head(df)
# }
```

*Documentation reproduced from package pcFactorStan, version 0.11, License: GPL (>= 3)*