# isolated: Find and remove isolated vertices In netdiffuseR: Analysis of Diffusion and Contagion Processes on Networks

## Description

Find and remove unconnected vertices from the graph.

## Usage

 ```1 2 3 4 5``` ```isolated(graph, undirected = getOption("diffnet.undirected", FALSE), self = getOption("diffnet.self", FALSE)) drop_isolated(graph, undirected = getOption("diffnet.undirected", FALSE), self = getOption("diffnet.self", FALSE)) ```

## Arguments

 `graph` Any class of accepted graph format (see `netdiffuseR-graphs`). `undirected` Logical scalar. When `TRUE` only the lower triangle of the adjacency matrix will considered (faster). `self` Logical scalar. When `TRUE` autolinks (loops, self edges) are allowed (see details).

## Value

When `graph` is an adjacency matrix:

 `isolated` an matrix of size n*1 with 1's where a node is isolated `drop_isolated` a modified graph excluding isolated vertices.

Otherwise, when `graph` is a list

 `isolated` an matrix of size n*T with 1's where a node is isolated `drop_isolated` a modified graph excluding isolated vertices.

## Author(s)

George G. Vega Yon

Other data management functions: `diffnet-class`, `edgelist_to_adjmat`, `egonet_attrs`, `survey_to_diffnet`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27``` ```# Generating random graph set.seed(123) adjmat <- rgraph_er() # Making nodes 1 and 4 isolated adjmat[c(1,4),] <- 0 adjmat[,c(1,4)] <- 0 adjmat # Finding isolated nodes iso <- isolated(adjmat) iso # Removing isolated nodes drop_isolated(adjmat) # Now with a dynamic graph graph <- rgraph_er(n=10, t=3) # Making 1 and 5 isolated graph <- lapply(graph, "[<-", i=c(1,5), j=1:10, value=0) graph <- lapply(graph, "[<-", i=1:10, j=c(1,5), value=0) graph isolated(graph) drop_isolated(graph) ```

### Example output

```Attaching package: 'netdiffuseR'

The following object is masked from 'package:base':

%*%

10 x 10 sparse Matrix of class "dgCMatrix"
[[ suppressing 10 column names '1', '2', '3' ... ]]

1  . . . . . . . . . .
2  . . 1 . . . . 1 . .
3  . 1 . . . . 1 . 1 .
4  . . . . . . . . . .
5  . . . . . . . . . .
6  . . . . 1 . . . 1 .
7  . . . . 1 . . . . .
8  . 1 . . 1 1 . . 1 .
9  . . . . . . . . . .
10 . . 1 . . 1 1 1 . .
isolated
1         1
2         0
3         0
4         1
5         0
6         0
7         0
8         0
9         0
10        0
8 x 8 sparse Matrix of class "dgCMatrix"
2 3 5 6 7 8 9 10
2  . 1 . . . 1 .  .
3  1 . . . 1 . 1  .
5  . . . . . . .  .
6  . . 1 . . . 1  .
7  . . 1 . . . .  .
8  1 . 1 1 . . 1  .
9  . . . . . . .  .
10 . 1 . 1 1 1 .  .
\$`1`
10 x 10 sparse Matrix of class "dgCMatrix"
[[ suppressing 10 column names '1', '2', '3' ... ]]

1  . . . . . . . . . .
2  . . . . . 1 . 1 1 .
3  . . . 1 . . 1 1 . .
4  . . . . . . . . . 1
5  . . . . . . . . . .
6  . 1 1 1 . . . . . .
7  . . . . . 1 . 1 . .
8  . . . . . . . . . .
9  . . . . . . . . . .
10 . 1 1 . . . . 1 . .

\$`2`
10 x 10 sparse Matrix of class "dgCMatrix"
[[ suppressing 10 column names '1', '2', '3' ... ]]

1  . . . . . . . . . .
2  . . . . . . 1 . . .
3  . . . . . . . . 1 .
4  . . . . . . . . . 1
5  . . . . . . . . . .
6  . . . . . . . . . .
7  . . . 1 . 1 . . . .
8  . . 1 . . 1 1 . . .
9  . . . 1 . . . 1 . 1
10 . . 1 . . . . . . .

\$`3`
10 x 10 sparse Matrix of class "dgCMatrix"
[[ suppressing 10 column names '1', '2', '3' ... ]]

1  . . . . . . . . . .
2  . . 1 . . . . . . .
3  . . . . . . 1 1 1 1
4  . . 1 . . . 1 1 . .
5  . . . . . . . . . .
6  . 1 . . . . 1 . . 1
7  . . 1 . . 1 . . . 1
8  . . . . . . 1 . . .
9  . . . . . . . . . .
10 . . . . . . . . 1 .

\$isolated_t
10 x 3 sparse Matrix of class "dgCMatrix"
1 2 3
1  1 1 1
2  . . .
3  . . .
4  . . .
5  1 1 1
6  . . .
7  . . .
8  . . .
9  . . .
10 . . .

\$isolated
isolated
1         1
2         0
3         0
4         0
5         1
6         0
7         0
8         0
9         0
10        0

\$`1`
8 x 8 sparse Matrix of class "dgCMatrix"
2 3 4 6 7 8 9 10
2  . . . 1 . 1 1  .
3  . . 1 . 1 1 .  .
4  . . . . . . .  1
6  1 1 1 . . . .  .
7  . . . 1 . 1 .  .
8  . . . . . . .  .
9  . . . . . . .  .
10 1 1 . . . 1 .  .

\$`2`
8 x 8 sparse Matrix of class "dgCMatrix"
2 3 4 6 7 8 9 10
2  . . . . 1 . .  .
3  . . . . . . 1  .
4  . . . . . . .  1
6  . . . . . . .  .
7  . . 1 1 . . .  .
8  . 1 . 1 1 . .  .
9  . . 1 . . 1 .  1
10 . 1 . . . . .  .

\$`3`
8 x 8 sparse Matrix of class "dgCMatrix"
2 3 4 6 7 8 9 10
2  . 1 . . . . .  .
3  . . . . 1 1 1  1
4  . 1 . . 1 1 .  .
6  1 . . . 1 . .  1
7  . 1 . 1 . . .  1
8  . . . . 1 . .  .
9  . . . . . . .  .
10 . . . . . . 1  .
```

netdiffuseR documentation built on June 7, 2018, 5:05 p.m.