Skip to content

Commit 27ded70

Browse files
committed
adjusted trans_vs_deg in post
1 parent 8c49615 commit 27ded70

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/post/description/_all_post.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ source("src/post/description/partial_extr.R")
2727
source("src/post/description/pref_attach.R")
2828
source("src/post/description/robustness.R")
2929
source("src/post/description/sex_stats.R")
30-
#source("src/post/description/trans_vs_deg.R")
30+
source("src/post/description/trans_vs_deg.R")
3131
#source("src/post/description/weight_plots.R")

src/post/description/trans_vs_deg.R

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ start.rec.log(text="TransVsDeg")
1818

1919
###############################################################################
2020
# compute the unfiltered data
21+
tlog(0, "Plotting transitivity vs. degree")
2122

2223
# read the graph
2324
graph.file <- get.path.data.graph(mode="scenes", net.type="static", filtered=FALSE, pref="graph", ext=".graphml")
2425
g <- read.graphml.file(file=graph.file)
2526

2627
# compute values
28+
tlog(2, "Computing values for unfiltered data")
2729
deg.vals <- degree(graph=g, mode="all")
2830
tra.vals <- transitivity(graph=g, type="local", weights=NA, isolates="zero")
2931

@@ -40,6 +42,7 @@ cut.tra <- filt.tra[filt.deg>=threshold]
4042
cut.deg <- filt.deg[filt.deg>=threshold]
4143

4244
# init parameters using a linear regression
45+
tlog(2, "Performing regression on unfiltered data")
4346
fit <- lm(log(cut.tra) ~ log(cut.deg))
4447
summary(fit)
4548
params <- fit$coefficients
@@ -62,7 +65,8 @@ col.sec <- combine.colors(col, "WHITE", transparency=20)
6265
xlab <- "Degree $k$"
6366
ylab <- "Local Transitivity $C(v)$"
6467
#exponent <- summary(fit)$coefficients["c2","Estimate"]
65-
plot.file <- get.path.stats.topo(net.type="static", mode="scenes", meas.name=MEAS_MULTI_NODES, filtered="both", suf="transitivity_vs_degree")
68+
plot.file <- get.path.stats.topo(net.type="static", mode="scenes", weight="none", meas.name=MEAS_MULTI_NODES, filtered="both", suf="transitivity_vs_degree")
69+
tlog(2, "Plotting in file \"",plot.file,"\"")
6670
pdf(file=paste0(plot.file,PLOT_FORMAT_PDF), bg="white")
6771
par(
6872
mar=c(4,4,0,0)+0.1, # remove the title space Bottom Left Top Right
@@ -130,11 +134,13 @@ legend(
130134
# add the plot for the filtered net, as an inset
131135

132136
# filter the characters
137+
tlog(2, "Filtering characters")
133138
filt.names <- V(g)$name[V(g)$Filter=="Discard"]
134139
if(length(filt.names)==0) stop("Empty list of filtered characters")
135140
g <- delete_vertices(g, V(g)$Filter=="Discard")
136141

137142
# compute values
143+
tlog(2, "Computing values for filtered data")
138144
deg.vals <- degree(graph=g, mode="all")
139145
tra.vals <- transitivity(graph=g, type="local", weights=NA, isolates="zero")
140146

@@ -151,6 +157,7 @@ cut.tra <- filt.tra[filt.deg>=threshold]
151157
cut.deg <- filt.deg[filt.deg>=threshold]
152158

153159
# init parameters using a linear regression
160+
tlog(2, "Performing regression on filtered data")
154161
fit <- lm(log(cut.tra) ~ log(cut.deg))
155162
summary(fit)
156163
params <- fit$coefficients
@@ -167,6 +174,7 @@ fit <- nlsLM(cut.tra ~ c1*cut.deg^c2,
167174
summary(fit)
168175

169176
# plot as an inset
177+
tlog(2, "Adding to plot")
170178
col <- pal["Keep"]
171179
col.sec <- combine.colors(col, "WHITE", transparency=20)
172180
par(

0 commit comments

Comments
 (0)