1- # Extracts dynamic ASOIAF networks.
1+ # Extracts dynamic ASOIAF networks. The "publication" order follows the comic publication
2+ # order. The "story" order matches parts of issues to novel chapter and reorder them
3+ # accordingly, in order to match the books.
24#
35# Vincent Labatut
46# 02/2023
@@ -24,6 +26,7 @@ inter.df <- data$inter.df
2426char.stats <- data $ char.stats
2527scene.stats <- data $ scene.stats
2628scene.chars <- data $ scene.chars
29+ panel.stats <- data $ panel.stats
2730page.stats <- data $ page.stats
2831volume.stats <- data $ volume.stats
2932scene.stats <- data $ scene.stats
@@ -38,28 +41,47 @@ for(filtered in c(FALSE,TRUE))
3841 scene.chars = scene.chars , scene.stats = scene.stats ,
3942 volume.stats = volume.stats ,
4043 filtered = filtered ,
41- pub.order = FALSE
44+ pub.order = TRUE ,
45+ narr.unit = " scene"
4246 )
43- cum.write.graph(gs = gg , filtered = filtered , pub.order = FALSE , char.det = " implicit" )
44- gg <- cum.read.graph(filtered = filtered , remove.isolates = TRUE , pub.order = FALSE , char.det = " implicit" )
47+ cum.write.graph(gs = gg , filtered = filtered , pub.order = TRUE , char.det = " implicit" )
48+ gg <- cum.read.graph(filtered = filtered , remove.isolates = TRUE , pub.order = TRUE , char.det = " implicit" )
4549}
4650
4751
52+
53+
54+ # ##############################################################################
4855# extract dynamic networks using the novel publication order (slightly different from the comic's)
4956tlog(2 ," Extracting novel-ordered dynamic networks" )
5057
5158# read map file
5259map.file <- file.path(DATA_FOLDER ," mapping.csv" )
5360map <- read.csv(map.file , header = TRUE , check.names = FALSE , stringsAsFactors = FALSE )
54- # compute page ranks
61+ # compute new page ranks
5562parts <- sapply(1 : nrow(page.stats ), function (p ) map [map [,COL_VOLUME ]== page.stats [p ,COL_VOLUME ] & map [,COL_PAGE_START ]< = page.stats [p ,COL_PAGE ] & map [,COL_PAGE_END ]> = page.stats [p ,COL_PAGE ], COL_RANK ])
5663page.stats [,COL_RANK ] <- rank(parts * (nrow(page.stats )+ 1 ) + page.stats [,COL_PAGE ])
57- # compute other ranks
64+ # compute other ranks based on new page ranks
5865panel.stats [,COL_RANK ] <- rank(page.stats [panel.stats [,COL_PAGE_ID ],COL_RANK ]* (nrow(panel.stats )+ 1 ) + panel.stats [,COL_PANEL ])
59- # TODO
60- scene.stats [,COL_RANK ] <- rank(volume.stats [scene.stats [,COL_VOLUME_ID ],COL_RANK ]* (nrow(scene.stats )+ 1 ) + scene.stats [,COL_SCENE_ID ], ties.method = " first" )
61- inter.df [,COL_RANK ] <- rank(volume.stats [inter.df [,COL_VOLUME_ID ],COL_RANK ]* (nrow(inter.df )+ 1 ) + 1 : nrow(inter.df ), ties.method = " first" )
66+ scene.stats [,COL_RANK ] <- rank(page.stats [scene.stats [,COL_PAGE_START_ID ],COL_RANK ]* (nrow(scene.stats )+ 1 ) + scene.stats [,COL_SCENE_ID ], ties.method = " first" )
67+ inter.df [,COL_RANK ] <- rank(page.stats [inter.df [,COL_PAGE_START_ID ],COL_RANK ]* (nrow(inter.df )+ 1 ) + 1 : nrow(inter.df ), ties.method = " first" )
6268
69+ # extract dynamic networks using the novel chapter order
70+ tlog(2 ," Extracting publication-ordered dynamic networks" )
71+ for (filtered in c(FALSE ,TRUE ))
72+ { tlog(4 ," Dealing with " ,if (filtered ) " " else " un" ," filtered networks" )
73+ gg <- cum.graph.extraction(
74+ inter.df = inter.df ,
75+ char.stats = char.stats ,
76+ scene.chars = scene.chars , scene.stats = scene.stats ,
77+ volume.stats = volume.stats ,
78+ filtered = filtered ,
79+ pub.order = FALSE ,
80+ narr.unit = " scene"
81+ )
82+ cum.write.graph(gs = gg , filtered = filtered , pub.order = FALSE , char.det = " implicit" )
83+ gg <- cum.read.graph(filtered = filtered , remove.isolates = TRUE , pub.order = FALSE , char.det = " implicit" )
84+ }
6385
6486
6587
0 commit comments