Skip to content

Commit

Permalink
fixed typos and cross-refs
Browse files Browse the repository at this point in the history
  • Loading branch information
mpeeples2008 committed Jun 9, 2022
1 parent f54670b commit 3986d4a
Show file tree
Hide file tree
Showing 37 changed files with 889 additions and 382 deletions.
2 changes: 1 addition & 1 deletion 03-exploratory-analysis.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Exploratory network analysis is simply exploratory data analysis applied to network data. This covers a range of statistical and visual techniques designed to explore the structure of networks as well as the relative positions of nodes and edges. These methods can be used to look for particular structures or patterning of interest, such as the most central nodes, or to summarize and describe the structure of the network to paint a general picture of it before further analysis. This section serves as a companion to Chapter 4 in the Brughmans and Peeples book (2022) and provides basic examples of the exploratory network analysis methods outlined in the book as well as a few others.

Note that we have created a distinct section on [exponential random graph models (ERGM)](#BeyondTheBook) in the "Beyond the Book" section of this document as that approach necessitates extended discussion. We replicate the boxed example from Chapter 4 of the book in that section.
Note that we have created a distinct section on [exponential random graph models (ERGM)](#BeyondTheBook) in the "Going Beyond the Book" section of this document as that approach necessitates extended discussion. We replicate the boxed example from Chapter 4 of the book in that section.

## Example Network Objects{#ExampleNetworkObjects}

Expand Down
2 changes: 1 addition & 1 deletion 06-spatial-networks.Rmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Spatial Networks{#SpatialNetworks}

This section follows along with Chapter 7 of Brughmans and Peeples (2022) to provide information on how to implement spatial network models and analyses in R. Spatial networks are one of the most common kinds of networks used in archaeological research. Many network studies rely on GIS tools to conduct spatial network research, but R is quite capable of spatial analysis. Note that we have created a separate section on [spatial interaction models](#BeyondTheBook) in the "Beyond the Book" section of this document as those approaches in particular requires extended discussion.
This section follows along with Chapter 7 of Brughmans and Peeples (2022) to provide information on how to implement spatial network models and analyses in R. Spatial networks are one of the most common kinds of networks used in archaeological research. Many network studies rely on GIS tools to conduct spatial network research, but R is quite capable of spatial analysis. Note that we have created a separate section on [spatial interaction models](#BeyondTheBook) in the "Beyond the Book" section of this document as those approaches in particular require extended discussion.

Working with geographic data in R can be a bit complicated and we cannot cover all aspects in this brief tutorial. If you are interested in exploring geospatial networks more, we suggest you take a look at the excellent and free [*Geocomputation With R*](https://geocompr.robinlovelace.net/) book by Robin Lovelace, Jakob Nowosad, and Jannes Muenchow. The book is a bookdown document just like this tutorial and provides excellent and up to date coverage of spatial operations and the management of spatial data in R.

Expand Down
267 changes: 227 additions & 40 deletions 07-beyond-the-book.Rmd

Large diffs are not rendered by default.

68 changes: 28 additions & 40 deletions _book/01-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,46 +225,34 @@ install_bundle_py(method = "auto", conda = "auto")
This version of the book was built with R version 4.2.0 (2022-04-22 ucrt) and the following packages:


|package |version |source |
|:--------------|:-------|:--------------|
|ape |5.6-2 |CRAN (R 4.2.0) |
|cccd |1.6 |CRAN (R 4.2.0) |
|colorspace |2.0-3 |CRAN (R 4.2.0) |
|concaveman |1.1.0 |CRAN (R 4.2.0) |
|d3r |1.0.0 |CRAN (R 4.2.0) |
|deldir |1.0-6 |CRAN (R 4.2.0) |
|devtools |2.4.3 |CRAN (R 4.2.0) |
|dplyr |1.0.9 |CRAN (R 4.2.0) |
|geosphere |1.5-14 |CRAN (R 4.2.0) |
|ggforce |0.3.3 |CRAN (R 4.2.0) |
|ggmap |3.0.0 |CRAN (R 4.2.0) |
|ggplot2 |3.3.6 |CRAN (R 4.2.0) |
|ggplotify |0.1.0 |CRAN (R 4.2.0) |
|ggpubr |0.4.0 |CRAN (R 4.2.0) |
|ggraph |2.0.5 |CRAN (R 4.2.0) |
|ggrepel |0.9.1 |CRAN (R 4.2.0) |
|ggsn |0.5.0 |CRAN (R 4.2.0) |
|GISTools |0.7-4 |CRAN (R 4.2.0) |
|igraph |1.3.1 |CRAN (R 4.2.0) |
|igraphdata |1.0.1 |CRAN (R 4.2.0) |
|intergraph |2.0-2 |CRAN (R 4.2.0) |
|maptools |1.1-4 |CRAN (R 4.2.0) |
|multinet |4.0.1 |CRAN (R 4.2.0) |
|networkD3 |0.4 |CRAN (R 4.2.0) |
|networkDynamic |0.11.2 |CRAN (R 4.2.0) |
|patchwork |1.1.1 |CRAN (R 4.2.0) |
|RColorBrewer |1.1-3 |CRAN (R 4.2.0) |
|Rcpp |1.0.8.3 |CRAN (R 4.2.0) |
|reshape2 |1.4.4 |CRAN (R 4.2.0) |
|rgeos |0.5-9 |CRAN (R 4.2.0) |
|rjson |0.2.21 |CRAN (R 4.2.0) |
|scatterplot3d |0.3-41 |CRAN (R 4.2.0) |
|sf |1.0-7 |CRAN (R 4.2.0) |
|statnet |2019.6 |CRAN (R 4.2.0) |
|superheat |0.1.0 |CRAN (R 4.2.0) |
|tidyverse |1.3.1 |CRAN (R 4.2.0) |
|vegan |2.6-2 |CRAN (R 4.2.0) |
|visNetwork |2.1.0 |CRAN (R 4.2.0) |
|package |version |source |
|:------------|:-------|:--------------|
|ape |5.6-2 |CRAN (R 4.2.0) |
|cccd |1.6 |CRAN (R 4.2.0) |
|colorspace |2.0-3 |CRAN (R 4.2.0) |
|deldir |1.0-6 |CRAN (R 4.2.0) |
|devtools |2.4.3 |CRAN (R 4.2.0) |
|dplyr |1.0.9 |CRAN (R 4.2.0) |
|geosphere |1.5-14 |CRAN (R 4.2.0) |
|ggforce |0.3.3 |CRAN (R 4.2.0) |
|ggmap |3.0.0 |CRAN (R 4.2.0) |
|ggplot2 |3.3.6 |CRAN (R 4.2.0) |
|ggplotify |0.1.0 |CRAN (R 4.2.0) |
|ggpubr |0.4.0 |CRAN (R 4.2.0) |
|ggraph |2.0.5 |CRAN (R 4.2.0) |
|ggrepel |0.9.1 |CRAN (R 4.2.0) |
|ggsn |0.5.0 |CRAN (R 4.2.0) |
|igraph |1.3.1 |CRAN (R 4.2.0) |
|intergraph |2.0-2 |CRAN (R 4.2.0) |
|multinet |4.0.1 |CRAN (R 4.2.0) |
|RColorBrewer |1.1-3 |CRAN (R 4.2.0) |
|Rcpp |1.0.8.3 |CRAN (R 4.2.0) |
|reshape2 |1.4.4 |CRAN (R 4.2.0) |
|sf |1.0-7 |CRAN (R 4.2.0) |
|statnet |2019.6 |CRAN (R 4.2.0) |
|superheat |0.1.0 |CRAN (R 4.2.0) |
|tidyverse |1.3.1 |CRAN (R 4.2.0) |
|vegan |2.6-2 |CRAN (R 4.2.0) |

## Suggested Workspace Setup{#WorkspaceSetup}

Expand Down
86 changes: 43 additions & 43 deletions _book/02-network-data-formats.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ cibola_net <-

# Display igraph network object and then plot a simple node-link diagram
cibola_net
#> IGRAPH 5b47d29 UN-- 30 167 --
#> IGRAPH 72df2fa UN-- 30 167 --
#> + attr: name (v/c)
#> + edges from 5b47d29 (vertex names):
#> + edges from 72df2fa (vertex names):
#> [1] Apache Creek--Casa Malpais
#> [2] Apache Creek--Coyote Creek
#> [3] Apache Creek--Hooper Ranch
Expand Down Expand Up @@ -116,7 +116,7 @@ adj_list <- igraph::as_adj_edge_list(cibola_net)

# examine adjacency list for the site Apache Creek
adj_list$`Apache Creek`
#> + 11/167 edges from 5b47d29 (vertex names):
#> + 11/167 edges from 72df2fa (vertex names):
#> [1] Apache Creek--Casa Malpais
#> [2] Apache Creek--Coyote Creek
#> [3] Apache Creek--Hooper Ranch
Expand All @@ -132,7 +132,7 @@ adj_list$`Apache Creek`
# It is also possible to call specific nodes by number. In this case,
# site 2 is Casa Malpais
adj_list[[2]]
#> + 11/167 edges from 5b47d29 (vertex names):
#> + 11/167 edges from 72df2fa (vertex names):
#> [1] Apache Creek--Casa Malpais
#> [2] Casa Malpais--Coyote Creek
#> [3] Casa Malpais--Hooper Ranch
Expand Down Expand Up @@ -315,9 +315,9 @@ V(cibola_net2)$region
# Note that "region" is now listed as an attribute when we view
# the network object
cibola_net2
#> IGRAPH 5b77b9e UN-- 31 167 --
#> IGRAPH 731938f UN-- 31 167 --
#> + attr: name (v/c), region (v/c)
#> + edges from 5b77b9e (vertex names):
#> + edges from 731938f (vertex names):
#> [1] Apache.Creek--Casa.Malpais
#> [2] Apache.Creek--Coyote.Creek
#> [3] Apache.Creek--Hooper.Ranch
Expand Down Expand Up @@ -370,9 +370,9 @@ simple_net_i <-
igraph::graph_from_adjacency_matrix(as.matrix(adj_mat2),
mode = "undirected")
simple_net_i
#> IGRAPH 5c67a67 UN-- 31 167 --
#> IGRAPH 7425077 UN-- 31 167 --
#> + attr: name (v/c)
#> + edges from 5c67a67 (vertex names):
#> + edges from 7425077 (vertex names):
#> [1] Apache.Creek--Casa.Malpais
#> [2] Apache.Creek--Coyote.Creek
#> [3] Apache.Creek--Hooper.Ranch
Expand Down Expand Up @@ -429,9 +429,9 @@ el2 <- cibola_edgelist[sample(seq(1, nrow(cibola_edgelist)), 125,
directed_net <-
igraph::graph_from_edgelist(as.matrix(el2), directed = TRUE)
directed_net
#> IGRAPH 5c6f435 DN-- 30 125 --
#> IGRAPH 742e30d DN-- 30 125 --
#> + attr: name (v/c)
#> + edges from 5c6f435 (vertex names):
#> + edges from 742e30d (vertex names):
#> [1] Coyote Creek ->Techado Springs
#> [2] Hubble Corner ->Tri-R Pueblo
#> [3] Hubble Corner ->Techado Springs
Expand Down Expand Up @@ -544,9 +544,9 @@ cibola_inc <- igraph::graph_from_incidence_matrix(cibola_clust,
directed = FALSE,
multiple = TRUE)
cibola_inc
#> IGRAPH 5cb592e UN-B 41 2214 --
#> IGRAPH 747c66f UN-B 41 2214 --
#> + attr: type (v/l), name (v/c)
#> + edges from 5cb592e (vertex names):
#> + edges from 747c66f (vertex names):
#> [1] Apache Creek--Clust1 Apache Creek--Clust1
#> [3] Apache Creek--Clust1 Apache Creek--Clust1
#> [5] Apache Creek--Clust1 Apache Creek--Clust1
Expand Down Expand Up @@ -938,9 +938,9 @@ ego_nets <- make_ego_graph(cibola_net)

# Examine the first ego-network
ego_nets[[1]]
#> IGRAPH 5e1d2f9 UN-- 12 59 --
#> IGRAPH 75fb60a UN-- 12 59 --
#> + attr: name (v/c)
#> + edges from 5e1d2f9 (vertex names):
#> + edges from 75fb60a (vertex names):
#> [1] Apache Creek--Casa Malpais
#> [2] Apache Creek--Coyote Creek
#> [3] Casa Malpais--Coyote Creek
Expand Down Expand Up @@ -1012,38 +1012,38 @@ The `multinet` network objects are compatible with `igraph` and individual layer
# multilayer network, the multinet package can help us do that directly
# and quite simply.
multinet::degree_ml(florentine)
#> [1] 5 6 3 1 7 4 4 3 11 2 3 6 6 3 6
#> [1] 4 7 4 3 11 2 3 6 3 6 6 5 6 3 1

# Similarly, we could apply cluster detection algorithms to all layers
# of a multilayer network simultaneously.
multinet::glouvain_ml(florentine)
#> actor layer cid
#> 1 Albizzi marriage 0
#> 2 Acciaiuoli marriage 0
#> 3 Tornabuoni business 0
#> 4 Tornabuoni marriage 0
#> 5 Ridolfi marriage 0
#> 6 Medici business 0
#> 7 Medici marriage 0
#> 8 Pazzi business 0
#> 9 Pazzi marriage 0
#> 10 Salviati business 0
#> 11 Salviati marriage 0
#> 12 Ginori business 0
#> 13 Ginori marriage 0
#> 14 Lamberteschi business 1
#> 15 Lamberteschi marriage 1
#> 16 Bischeri business 1
#> 17 Bischeri marriage 1
#> 18 Guadagni business 1
#> 19 Guadagni marriage 1
#> 20 Barbadori business 2
#> 21 Barbadori marriage 2
#> 22 Peruzzi business 2
#> 23 Peruzzi marriage 2
#> 24 Strozzi marriage 2
#> 25 Castellani business 2
#> 26 Castellani marriage 2
#> 1 Guadagni business 0
#> 2 Guadagni marriage 0
#> 3 Bischeri business 0
#> 4 Bischeri marriage 0
#> 5 Lamberteschi business 0
#> 6 Lamberteschi marriage 0
#> 7 Tornabuoni business 1
#> 8 Tornabuoni marriage 1
#> 9 Ridolfi marriage 1
#> 10 Medici business 1
#> 11 Medici marriage 1
#> 12 Pazzi business 1
#> 13 Pazzi marriage 1
#> 14 Salviati business 1
#> 15 Salviati marriage 1
#> 16 Acciaiuoli marriage 1
#> 17 Strozzi marriage 2
#> 18 Peruzzi business 2
#> 19 Peruzzi marriage 2
#> 20 Castellani business 2
#> 21 Castellani marriage 2
#> 22 Barbadori business 2
#> 23 Barbadori marriage 2
#> 24 Ginori business 3
#> 25 Ginori marriage 3
#> 26 Albizzi marriage 3
```

For an archaeological example of multilevel network analysis [this GitHub project](https://github.com/ajupton/archy-multilayer-nets) by Andy Upton.
Expand Down Expand Up @@ -1071,10 +1071,10 @@ Here is a simple example:
```r
mor_wt_i <- asIgraph(mor_wt)
mor_wt_i
#> IGRAPH 5e8ef7a U-W- 31 465 --
#> IGRAPH 7674f52 U-W- 31 465 --
#> + attr: na (v/l), vertex.names (v/c), na (e/l),
#> | weight (e/n)
#> + edges from 5e8ef7a:
#> + edges from 7674f52:
#> [1] 1-- 2 1-- 3 1-- 4 1-- 5 1-- 6 1-- 7 1-- 8 1-- 9 1--10
#> [10] 1--11 1--12 1--13 1--14 1--15 1--16 1--17 1--18 1--19
#> [19] 1--20 1--21 1--22 1--23 1--24 1--25 1--26 1--27 1--28
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 11 additions & 11 deletions _book/03-exploratory-analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Exploratory network analysis is simply exploratory data analysis applied to network data. This covers a range of statistical and visual techniques designed to explore the structure of networks as well as the relative positions of nodes and edges. These methods can be used to look for particular structures or patterning of interest, such as the most central nodes, or to summarize and describe the structure of the network to paint a general picture of it before further analysis. This section serves as a companion to Chapter 4 in the Brughmans and Peeples book (2022) and provides basic examples of the exploratory network analysis methods outlined in the book as well as a few others.

Note that we have created a distinct section on [exponential random graph models (ERGM)](#BeyondTheBook) in the "Beyond the Book" section of this document as that approach necessitates extended discussion. We replicate the boxed example from Chapter 4 of the book in that section.
Note that we have created a distinct section on [exponential random graph models (ERGM)](#BeyondTheBook) in the "Going Beyond the Book" section of this document as that approach necessitates extended discussion. We replicate the boxed example from Chapter 4 of the book in that section.

## Example Network Objects{#ExampleNetworkObjects}

Expand Down Expand Up @@ -480,7 +480,7 @@ If you want to identify particular shortest paths to or from nodes in a network
igraph::shortest_paths(simple_net, from = 1, to = 21)
#> $vpath
#> $vpath[[1]]
#> + 5/31 vertices, named, from 621020e:
#> + 5/31 vertices, named, from 7a3b412:
#> [1] Apache.Creek Casa.Malpais
#> [3] Garcia.Ranch Heshotauthla
#> [5] Pueblo.de.los.Muertos
Expand Down Expand Up @@ -509,7 +509,7 @@ igraph::diameter(directed_net, directed = TRUE)

igraph::farthest_vertices(directed_net, directed = TRUE)
#> $vertices
#> + 2/30 vertices, named, from 6211083:
#> + 2/30 vertices, named, from 7a3c4ef:
#> [1] Apache Creek Pueblo de los Muertos
#>
#> $distance
Expand Down Expand Up @@ -547,9 +547,9 @@ components <- igraph::decompose(simple_net, min.vertices = 1)

components
#> [[1]]
#> IGRAPH 6470be5 UN-- 30 167 --
#> IGRAPH 7cb306a UN-- 30 167 --
#> + attr: name (v/c)
#> + edges from 6470be5 (vertex names):
#> + edges from 7cb306a (vertex names):
#> [1] Apache.Creek--Casa.Malpais
#> [2] Apache.Creek--Coyote.Creek
#> [3] Apache.Creek--Hooper.Ranch
Expand All @@ -561,9 +561,9 @@ components
#> + ... omitted several edges
#>
#> [[2]]
#> IGRAPH 6470c09 UN-- 1 0 --
#> IGRAPH 7cb3091 UN-- 1 0 --
#> + attr: name (v/c)
#> + edges from 6470c09 (vertex names):
#> + edges from 7cb3091 (vertex names):

V(components[[2]])$name
#> [1] "WS.Ranch"
Expand Down Expand Up @@ -605,15 +605,15 @@ min_cut(simple_net_noiso, value.only = FALSE)
#> [1] 1
#>
#> $cut
#> + 1/167 edge from 62107b0 (vertex names):
#> + 1/167 edge from 7a3bb69 (vertex names):
#> [1] Ojo Bonito--Baca Pueblo
#>
#> $partition1
#> + 1/30 vertex, named, from 62107b0:
#> + 1/30 vertex, named, from 7a3bb69:
#> [1] Baca Pueblo
#>
#> $partition2
#> + 29/30 vertices, named, from 62107b0:
#> + 29/30 vertices, named, from 7a3bb69:
#> [1] Apache Creek Casa Malpais
#> [3] Coyote Creek Hooper Ranch
#> [5] Horse Camp Mill Hubble Corner
Expand All @@ -640,7 +640,7 @@ A clique as a network science concept is arguably the strictest method of defini

```r
max_cliques(simple_net, min = 1)[[24]]
#> + 9/31 vertices, named, from 621020e:
#> + 9/31 vertices, named, from 7a3b412:
#> [1] Los.Gigantes Cienega Tinaja
#> [4] Spier.170 Scribe.S Pescado.Cluster
#> [7] Mirabal Heshotauthla Yellowhouse
Expand Down
4 changes: 2 additions & 2 deletions _book/05-visualization.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ cibola_attr <- read.csv(file = "data/Cibola_attr.csv", header = TRUE)
cibola_i <- igraph::graph_from_adjacency_matrix(as.matrix(cibola),
mode = "undirected")
cibola_i
#> IGRAPH 6f6b278 UN-- 31 167 --
#> IGRAPH 87a56e5 UN-- 31 167 --
#> + attr: name (v/c)
#> + edges from 6f6b278 (vertex names):
#> + edges from 87a56e5 (vertex names):
#> [1] Apache.Creek--Casa.Malpais
#> [2] Apache.Creek--Coyote.Creek
#> [3] Apache.Creek--Hooper.Ranch
Expand Down
6 changes: 3 additions & 3 deletions _book/06-spatial-networks.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Spatial Networks{#SpatialNetworks}

This section follows along with Chapter 7 of Brughmans and Peeples (2022) to provide information on how to implement spatial network models and analyses in R. Spatial networks are one of the most common kinds of networks used in archaeological research. Many network studies rely on GIS tools to conduct spatial network research, but R is quite capable of spatial analysis. Note that we have created a separate section on [spatial interaction models](#BeyondTheBook) in the "Beyond the Book" section of this document as those approaches in particular requires extended discussion.
This section follows along with Chapter 7 of Brughmans and Peeples (2022) to provide information on how to implement spatial network models and analyses in R. Spatial networks are one of the most common kinds of networks used in archaeological research. Many network studies rely on GIS tools to conduct spatial network research, but R is quite capable of spatial analysis. Note that we have created a separate section on [spatial interaction models](#BeyondTheBook) in the "Beyond the Book" section of this document as those approaches in particular require extended discussion.

Working with geographic data in R can be a bit complicated and we cannot cover all aspects in this brief tutorial. If you are interested in exploring geospatial networks more, we suggest you take a look at the excellent and free [*Geocomputation With R*](https://geocompr.robinlovelace.net/) book by Robin Lovelace, Jakob Nowosad, and Jannes Muenchow. The book is a bookdown document just like this tutorial and provides excellent and up to date coverage of spatial operations and the management of spatial data in R.

Expand Down Expand Up @@ -273,9 +273,9 @@ Let's create a simple tree using the `make_tree` function in igraph.
```r
tree1 <- make_tree(n = 50, children = 5, mode = "undirected")
tree1
#> IGRAPH 9b7a256 U--- 50 49 -- Tree
#> IGRAPH b584e92 U--- 50 49 -- Tree
#> + attr: name (g/c), children (g/n), mode (g/c)
#> + edges from 9b7a256:
#> + edges from b584e92:
#> [1] 1-- 2 1-- 3 1-- 4 1-- 5 1-- 6 2-- 7 2-- 8 2-- 9
#> [9] 2--10 2--11 3--12 3--13 3--14 3--15 3--16 4--17
#> [17] 4--18 4--19 4--20 4--21 5--22 5--23 5--24 5--25
Expand Down
Loading

0 comments on commit 3986d4a

Please sign in to comment.