Skip to content

Commit f5e7d51

Browse files
committed
fixed minor bug in plot paths
1 parent a263126 commit f5e7d51

6 files changed

Lines changed: 61 additions & 57 deletions

File tree

src/Labatut2022.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This script reproduces the computations described in the following paper:
22
#
33
# V. Labatut,
4-
# “,”
4+
#Complex Network Analysis of a Graphic Novel: The Case of the Bande Dessinée Thorgal,”
55
# Submitted, 2022.
66
#
77
# Vincent Labatut
@@ -34,25 +34,25 @@ start.rec.log(text=SERIES)
3434

3535
###############################################################################
3636
# read raw data
37-
#data <- read.raw.data()
37+
data <- read.raw.data()
3838
# OR, if already computed, read from file
39-
data <- read.corpus.data()
39+
#data <- read.corpus.data()
4040

4141
# compute corpus stats
42-
#data <- compute.corpus.stats(data)
42+
data <- compute.corpus.stats(data)
4343

4444
# plot corpus stats
45-
#plot.corpus.stats(data)
45+
plot.corpus.stats(data)
4646

4747

4848

4949

5050
###############################################################################
5151
# extract static networks
52-
#data <- extract.static.graphs.base(data)
52+
data <- extract.static.graphs.base(data)
5353

5454
# plot these graphs
55-
#plot.static.graphs(data)
55+
plot.static.graphs(data)
5656

5757

5858

src/common/include.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ source("src/common/strings.R")
7575
source("src/common/file_system.R")
7676
source("src/common/table_cols.R")
7777
source("src/common/plot_graphs.R")
78-
source("src/common/topo_measures.R")
78+
79+
source("src/measures/measures.R")
7980

8081
source("src/graphs/misc.R")
8182

src/graphs/topomeas.R

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ transitivity.vs.degree <- function(g, weights=FALSE, filename, col=MAIN_COLOR)
3131
if(weights)
3232
{ deg.vals <- strength(g, mode="all")
3333
xlab <- "Strength $s$"
34-
base.name <- paste0(filename,"_trans_vs_strength")
34+
base.name <- paste0(filename,"_transitivity_vs_strength")
3535
}
3636
else
3737
{ deg.vals <- degree(g, mode="all")
3838
xlab <- "Degree $k$"
39-
base.name <- paste0(filename,"_trans_vs_degree")
39+
base.name <- paste0(filename,"_transitivity_vs_degree")
4040
}
4141

4242
# filter out zero transitivity
@@ -175,17 +175,17 @@ neigh.degree.vs.degree <- function(g, weights=FALSE, filename, col=MAIN_COLOR)
175175
# compute the values
176176
if(weights)
177177
{ deg.vals <- strength(graph=g, mode="all")
178-
tmp <- igraph::knn(graph=g)#, mode="all", neighbor.degree.mode="all")
178+
tmp <- igraph::knn(graph=g)#, mode="all", neighbor.degree.mode="all") # TODO according to the plots, there's seems to be a problem here
179179
xlab <- "Strength $s$"
180180
ylab <- "Neighbors' average Strength $<s_{nn}>$"
181-
base.name <- paste0(filename,"_neideg_vs_strength")
181+
base.name <- paste0(filename,"_nei-degree_vs_strength")
182182
}
183183
else
184184
{ deg.vals <- degree(graph=g, mode="all")
185185
tmp <- igraph::knn(graph=g, weights=NULL)#, mode="all", neighbor.degree.mode="all")
186186
xlab <- "Degree $k$"
187187
ylab <- "Neighbors' average Degree $<k_{nn}>$"
188-
base.name <- paste0(filename,"_neideg_vs_degree")
188+
base.name <- paste0(filename,"_nei-degree_vs_degree")
189189
}
190190

191191
# filter out zero degree and NaN
@@ -325,7 +325,7 @@ neigh.degree.vs.degree <- function(g, weights=FALSE, filename, col=MAIN_COLOR)
325325
# returns: result of the estimation and goodness of fit.
326326
###############################################################################
327327
hop.plot <- function(g, weights=FALSE, filename, col=MAIN_COLOR)
328-
{ base.file <- paste0(filename,"_neisize_vs_distance")
328+
{ base.file <- paste0(filename,"hop-plot_nei-size_vs_distance")
329329
col.sec <- combine.colors(col, "WHITE", transparency=20)
330330

331331
# compute required distances
@@ -360,11 +360,10 @@ hop.plot <- function(g, weights=FALSE, filename, col=MAIN_COLOR)
360360
ylim=yl,
361361
xlab=TeX(xlab),
362362
ylab=TeX("Proportion of vertices"),
363-
log="y", yaxt="n",
364-
col=col.sec
363+
log="y", yaxt="n"
365364
)
366365
for(u in 1:n)
367-
points(x=dist.vals, y=hp.vals[u,], col="PINK")
366+
points(x=dist.vals, y=hp.vals[u,], col=col.sec)
368367
# render the y-axis
369368
expmax <- floor(log(min(yl[1]),10))
370369
axis(

src/post/description/_all_post.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212

1313

1414
source("src/post/description/avgdist_evol.R")
15+
#########
1516
source("src/post/description/centr_clusters.R")
1617
source("src/post/description/centr_vs_centr.R")
1718
source("src/post/description/centr_vs_occ.R")
1819
source("src/post/description/char_distr.R")
1920
source("src/post/description/char_sim.R")
21+
source("src/post/description/char_tj_comp.R")
2022
source("src/post/description/comp_vs_edges.R")
2123
source("src/post/description/comp_vs_vertices.R")
2224
source("src/post/description/deg_plots.R")

src/static/plot_stats.R

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,46 +1156,48 @@ generate.static.plots.scene <- function(arc=NA, vol=NA, filtered=FALSE)
11561156
}
11571157
}
11581158

1159-
# compute and plot additional stuff
1160-
# read the graph
1161-
graph.file <- get.path.data.graph(mode="scenes", net.type="static", filtered=FALSE, pref="graph", ext=".graphml")
1162-
g <- read.graphml.file(file=graph.file)
1163-
if(filtered)
1164-
g <- delete_vertices(graph=g, v=which(V(g)$Filter=="Discard"))
1165-
g.dur <- g; E(g.dur)$weight <- E(g)$Duration
1166-
g.occ <- g; E(g.occ)$weight <- E(g)$Occurrences
1167-
1168-
# degree vs. neighbors' degree
1169-
filename <- get.path.stats.topo(mode=mode, net.type="static", meas.name=MEAS_DEGREE, weights=wmode, arc=arc, vol=vol, filtered=filt.txt, suf="nei.deg_vs_degree")
1170-
neigh.degree.vs.degree(g, weights=FALSE, filename, col)
1171-
for(wmode in c("occurrences","duration"))
1172-
{ filename <- get.path.stats.topo(mode=mode, net.type="static", meas.name=MEAS_STRENGTH, weights=wmode, arc=arc, vol=vol, filtered=filt.txt, suf="nei.str_vs_strength")
1173-
if(wmode=="duration")
1174-
neigh.degree.vs.degree(g.dur, weights=TRUE, filename, col)
1175-
else if(wmode=="occurrences")
1176-
neigh.degree.vs.degree(g.occ, weights=TRUE, filename, col)
1177-
}
1178-
1179-
# degree vs. transitivity
1180-
filename <- get.path.stats.topo(mode=mode, net.type="static", meas.name=MEAS_MULTI_NODES, weights=wmode, arc=arc, vol=vol, filtered=filt.txt, suf="transitivity_vs_degree")
1181-
transitivity.vs.degree(g, weights=FALSE, filename, col)
1182-
for(wmode in c("occurrences","duration"))
1183-
{ filename <- get.path.stats.topo(mode=mode, net.type="static", meas.name=MEAS_MULTI_NODES, weights=wmode, arc=arc, vol=vol, filtered=filt.txt, suf="transitivity_vs_strength")
1184-
if(wmode=="duration")
1185-
transitivity.vs.degree(g.dur, weights=TRUE, filename, col)
1186-
else if(wmode=="occurrences")
1187-
transitivity.vs.degree(g.occ, weights=TRUE, filename, col)
1188-
}
1189-
1190-
# hop plots
1191-
filename <- get.path.stats.topo(mode=mode, net.type="static", meas.name=MEAS_DISTANCE, weights=wmode, arc=arc, vol=vol, filtered=filt.txt, suf="hop-plot")
1192-
hop.plot(g, weights=FALSE, filename, col)
1193-
for(wmode in c("occurrences","duration"))
1194-
{ filename <- get.path.stats.topo(mode=mode, net.type="static", meas.name=MEAS_DISTANCE, weights=wmode, arc=arc, vol=vol, filtered=filt.txt, suf="hop-plot")
1195-
if(wmode=="duration")
1196-
hop.plot(g.dur, weights=TRUE, filename, col)
1197-
else if(wmode=="occurrences")
1198-
hop.plot(g.occ, weights=TRUE, filename, col)
1159+
# compute and plot additional stuff (not for volume- or arc-specific graphs)
1160+
if(is.na(vol) && is.na(arc))
1161+
{ # read the graph
1162+
graph.file <- get.path.data.graph(mode="scenes", net.type="static", filtered=FALSE, pref="graph", ext=".graphml")
1163+
g <- read.graphml.file(file=graph.file)
1164+
if(filtered)
1165+
g <- delete_vertices(graph=g, v=which(V(g)$Filter=="Discard"))
1166+
g.dur <- g; E(g.dur)$weight <- E(g)$Duration
1167+
g.occ <- g; E(g.occ)$weight <- E(g)$Occurrences
1168+
1169+
# degree vs. neighbors' degree
1170+
filename <- get.path.stats.topo(mode=mode, net.type="static", meas.name=MEAS_MULTI_NODES, weights="none", arc=arc, vol=vol, filtered=filt.txt)
1171+
neigh.degree.vs.degree(g=g, weights=FALSE, filename=filename, col=col)
1172+
for(wmode in c("occurrences","duration"))
1173+
{ filename <- get.path.stats.topo(mode=mode, net.type="static", meas.name=MEAS_MULTI_NODES, weights=wmode, arc=arc, vol=vol, filtered=filt.txt)
1174+
if(wmode=="duration")
1175+
neigh.degree.vs.degree(g=g.dur, weights=TRUE, filename=filename, col=col)
1176+
else if(wmode=="occurrences")
1177+
neigh.degree.vs.degree(g=g.occ, weights=TRUE, filename=filename, col=col)
1178+
}
1179+
1180+
# degree vs. transitivity
1181+
filename <- get.path.stats.topo(mode=mode, net.type="static", meas.name=MEAS_MULTI_NODES, weights="none", arc=arc, vol=vol, filtered=filt.txt)
1182+
transitivity.vs.degree(g=g, weights=FALSE, filename=filename, col=col)
1183+
for(wmode in c("occurrences","duration"))
1184+
{ filename <- get.path.stats.topo(mode=mode, net.type="static", meas.name=MEAS_MULTI_NODES, weights=wmode, arc=arc, vol=vol, filtered=filt.txt)
1185+
if(wmode=="duration")
1186+
transitivity.vs.degree(g=g.dur, weights=TRUE, filename=filename, col=col)
1187+
else if(wmode=="occurrences")
1188+
transitivity.vs.degree(g=g.occ, weights=TRUE, filename=filename, col=col)
1189+
}
1190+
1191+
# hop plots
1192+
filename <- get.path.stats.topo(mode=mode, net.type="static", meas.name=MEAS_MULTI_NODEPAIRS, weights="none", arc=arc, vol=vol, filtered=filt.txt)
1193+
hop.plot(g=g, weights=FALSE, filename=filename, col=col)
1194+
for(wmode in c("occurrences","duration"))
1195+
{ filename <- get.path.stats.topo(mode=mode, net.type="static", meas.name=MEAS_MULTI_NODEPAIRS, weights=wmode, arc=arc, vol=vol, filtered=filt.txt)
1196+
if(wmode=="duration")
1197+
hop.plot(g=g.dur, weights=TRUE, filename=filename, col=col)
1198+
else if(wmode=="occurrences")
1199+
hop.plot(g=g.occ, weights=TRUE, filename=filename, col=col)
1200+
}
11991201
}
12001202
}
12011203

0 commit comments

Comments
 (0)