@@ -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
2324graph.file <- get.path.data.graph(mode = " scenes" , net.type = " static" , filtered = FALSE , pref = " graph" , ext = " .graphml" )
2425g <- read.graphml.file(file = graph.file )
2526
2627# compute values
28+ tlog(2 , " Computing values for unfiltered data" )
2729deg.vals <- degree(graph = g , mode = " all" )
2830tra.vals <- transitivity(graph = g , type = " local" , weights = NA , isolates = " zero" )
2931
@@ -40,6 +42,7 @@ cut.tra <- filt.tra[filt.deg>=threshold]
4042cut.deg <- filt.deg [filt.deg > = threshold ]
4143
4244# init parameters using a linear regression
45+ tlog(2 , " Performing regression on unfiltered data" )
4346fit <- lm(log(cut.tra ) ~ log(cut.deg ))
4447summary(fit )
4548params <- fit $ coefficients
@@ -62,7 +65,8 @@ col.sec <- combine.colors(col, "WHITE", transparency=20)
6265xlab <- " Degree $k$"
6366ylab <- " 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 ," \" " )
6670pdf(file = paste0(plot.file ,PLOT_FORMAT_PDF ), bg = " white" )
6771par(
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" )
133138filt.names <- V(g )$ name [V(g )$ Filter == " Discard" ]
134139if (length(filt.names )== 0 ) stop(" Empty list of filtered characters" )
135140g <- delete_vertices(g , V(g )$ Filter == " Discard" )
136141
137142# compute values
143+ tlog(2 , " Computing values for filtered data" )
138144deg.vals <- degree(graph = g , mode = " all" )
139145tra.vals <- transitivity(graph = g , type = " local" , weights = NA , isolates = " zero" )
140146
@@ -151,6 +157,7 @@ cut.tra <- filt.tra[filt.deg>=threshold]
151157cut.deg <- filt.deg [filt.deg > = threshold ]
152158
153159# init parameters using a linear regression
160+ tlog(2 , " Performing regression on filtered data" )
154161fit <- lm(log(cut.tra ) ~ log(cut.deg ))
155162summary(fit )
156163params <- fit $ coefficients
@@ -167,6 +174,7 @@ fit <- nlsLM(cut.tra ~ c1*cut.deg^c2,
167174summary(fit )
168175
169176# plot as an inset
177+ tlog(2 , " Adding to plot" )
170178col <- pal [" Keep" ]
171179col.sec <- combine.colors(col , " WHITE" , transparency = 20 )
172180par(
0 commit comments