Skip to content

Commit

Permalink
Merge pull request #12 from saladserenade/patch-1
Browse files Browse the repository at this point in the history
Update chapter13.qmd
  • Loading branch information
vanatteveldt authored Nov 2, 2023
2 parents 7132a7a + 1263279 commit bccc154
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion content/chapter13.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ The mathematical representation of a graph $G=(V,E)$ is based on a set of nodes
The network approach in social sciences has an enormous potential to model and predict *social actions*. There is empirical evidence that we can successfully apply this framework to explain distinct phenomena such as political opinions, obesity, and happiness, given the influence of our friends (or even of the friends of our friends) over our behavior [@christakis2009connected]. The network created by this sophisticated structure of human and social connections is an ideal scenario to understand how close we are to each other in terms of degrees of separation [@watts2004six] in small (e.g., a school) and large-scale (e.g., a global pandemic) social dynamics. Moreover, the network approach can help us to track the propagation either of a virus in epidemiology, or a fake news story in political and social sciences, such as in the work by
@vosoughi2018spread.

Now, let us show you how to create and visualize network structures in R and Python. As we mentioned above, the structure of a graph is based on nodes and edges, which are the fundamental components of any network. Suppose that we want to model the social network of five American politicians in 2017 (Donald Trump, Bernie Sanders, Hillary Clinton, Barack Obama and John McCain), based on their *imaginary* connections on Facebook (friending) and Twitter (following)[^2]. Technically, the base of any graph is a list of edges (written as pair of nodes that indicate the relationships) and a list of nodes (some nodes might be isolated without any connection!). For instance, the friendship on Facebook between two politicians would normally be expressed as two strings separated by comma (e.g., "Hillary Clinton", "Donald Trump"). In Example [-@exm-graph] we use libraries *igraph* (R)[^3] and *networkx* (Python) to create from scratch a simple graph with five nodes and four edges, using the above-mentioned structure of pairs of nodes (notice that we only include the edges while the vertices are automatically generated).
Now, let us show you how to create and visualize network structures in R and Python. As we mentioned above, the structure of a graph is based on nodes and edges, which are the fundamental components of any network. Suppose that we want to model the social network of five American politicians in 2017 (Donald Trump, Bernie Sanders, Hillary Clinton, Barack Obama and John McCain), based on their *imaginary* connections on Facebook (friending) and Twitter (following)[^2]. Technically, the base of any graph is a list of edges (written as pair of nodes that indicate the relationships) and a list of nodes (some nodes might be isolated without any connection!). For instance, the friendship on Facebook between two politicians would normally be expressed as two strings separated by comma (e.g., "Hillary Clinton", "Donald Trump"). In Example [-@exm-graph] we use libraries *igraph* (R)[^3] and *networkx* (Python) to create from scratch a simple graph with five nodes and five edges, using the above-mentioned structure of pairs of nodes (notice that we only include the edges while the vertices are automatically generated).

::: {.callout-note appearance="simple" icon=false}

Expand Down

0 comments on commit bccc154

Please sign in to comment.