challenge1
Mekhala Kumar
gotmarriages
fish_encounters
Author

Mekhala Kumar

Published

February 22, 2023

Reading in the data

Code
got_marriages<-read_csv("_data/got/got_marriages.csv")
Rows: 255 Columns: 5
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (5): From, To, Type, Notes, Generation

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Code
head(got_marriages)
# A tibble: 6 × 5
  From      To      Type    Notes  Generation
  <chr>     <chr>   <chr>   <chr>  <chr>     
1 Targaryen Stark   Married R+L=J  Current   
2 Baratheon Martell Engaged died   Current   
3 Baratheon Stark   Engaged broken Current   
4 Martell   Essos   Married <NA>   Current   
5 Martell   Reach   Affair  <NA>   Current   
6 Martell   Essos   Affair  <NA>   Current   

Creating the network

Code
got_marriages_net<-graph_from_data_frame(got_marriages,directed=FALSE)

Features of the network

The network has 20 vertices and 255 edges. It is a unimodal, undirected and unweighted network.

Code
vcount(got_marriages_net)
[1] 20
Code
ecount(got_marriages_net)
[1] 255
Code
is_bipartite(got_marriages_net)
[1] FALSE
Code
is_directed(got_marriages_net)
[1] FALSE
Code
is_weighted(got_marriages_net)
[1] FALSE
Code
vertex_attr_names(got_marriages_net)
[1] "name"
Code
edge_attr_names(got_marriages_net)
[1] "Type"       "Notes"      "Generation"

Plotting the network

Code
plot(got_marriages_net)

##Trying a Second dataset The fish encounters network has 30 vertices and 114 edges. It is also a unimodal, undirected and unweighted network. I am not sure how to interpret the plot for the fish encounters data.

Code
fish<-fish_encounters
head(fish)
# A tibble: 6 × 3
  fish  station  seen
  <fct> <fct>   <int>
1 4842  Release     1
2 4842  I80_1       1
3 4842  Lisbon      1
4 4842  Rstr        1
5 4842  Base_TD     1
6 4842  BCE         1
Code
fish_n<-graph_from_data_frame(fish_encounters,directed=FALSE)
vcount(fish_n)
[1] 30
Code
ecount(fish_n)
[1] 114
Code
is_bipartite(fish_n)
[1] FALSE
Code
is_directed(fish_n)
[1] FALSE
Code
is_weighted(fish_n)
[1] FALSE
Code
vertex_attr_names(fish_n)
[1] "name"
Code
edge_attr_names(fish_n)
[1] "seen"
Code
plot(fish_n)