Changeset - 29857512e53b
[Not reviewed]
0 1 1
Tom Bannink - 8 years ago 2017-06-27 13:11:42
tom.bannink@cwi.nl
Add triangle creation frequency histogram plots
2 files changed with 29 insertions and 4 deletions:
0 comments (0 inline, 0 general)
plots/triangle_creation_frequencies_log.pdf
Show inline comments
 
new file 100644
 
binary diff not shown
triangle_creation_frequency_plots.m
Show inline comments
 
@@ -14,17 +14,23 @@ gsraw=Import[NotebookDirectory[]<>"data/graphdata_timeevol.m"];
 
gdata=GatherBy[gsraw,{#[[1,2]]&,#[[1,1]]&}];
 
(* Data format: *)
 
(* gdata[[ tau index, n index, run index , datatype index ]] *)
 
(* datatype index:
 
1: {n,tau}
 
2: #triangles time sequence
 
3: degree sequence
 
*)
 
nlabels=Map["n = "<>ToString[#]&,gdata[[1,All,1,1,1]]];
 
taulabels=Map["tau = "<>ToString[#]&,gdata[[All,1,1,1,2]]];
 

	
 

	
 
(* Get the runs that have the same degree sequence *)
 
gdata2=GatherBy[gsraw,{#[[1,2]]&,#[[1,1]]&,#[[3]]&}];
 
(* gdata[[ tau index, n index, ds run index, MC run index , datatype index ]] *)
 

	
 

	
 
(* ::Section:: *)
 
(*Triangle creation frequencies*)
 

	
 

	
 
(* ::Subsection:: *)
 
(*Plot triangle count over "time" in Markov chain instances*)
 
@@ -41,14 +47,33 @@ skipPts=Max[1,Round[maxTime/500]]; (* Plotting every point is slow. Plot only on
 
coarseData=Map[#[[2,1;;maxTime;;skipPts]]&,selectedData];
 
labels=Map["{n,tau} = "<>ToString[#[[1]]]&,selectedData];
 
ListPlot[coarseData,Joined->True,PlotRange->{0*minCount,maxCount},DataRange->{0,measureSkip*maxTime},PlotLegends->labels]
 
(* Map[ListPlot[#,Joined->True,PlotRange\[Rule]{minCount,maxCount},DataRange\[Rule]{0,maxTime}]&,coarseData] *)
 

	
 

	
 
differences=Map[Differences[#[[2,25000;;-1]]]&,gdata,{3}];
 
differences=Map[Differences[#[[2,25000;;-1]]]&,gdata2,{4}];
 
differences=Map[Flatten,differences,{3}];
 

	
 

	
 
(* For each (n,tau) take 2 degree sequences *)
 
histograms1=Map[Histogram[#[[{2,1}]],{-25.5,25.5,1},{"Log","Probability"},ImageSize->280]&,differences,{2}];
 

	
 

	
 
(* For each (n,tau) take the average over all degree sequences *)
 
histograms2=Map[Histogram[Flatten[#],{-3.5,3.5,1},"Probability",PlotRange->{0,1},LabelingFunction->(Placed[NumberForm[#,{2,3}],Above]&),ImageSize->280]&,differences,{2}];
 

	
 

	
 
TableForm[histograms2,TableHeadings->{taulabels,nlabels}]
 

	
 

	
 
(* Take three runs of each *)
 
histograms=Map[Histogram[#[[{1,6,11,16}]],{-20,20,1},"LogCount",ImageSize->300]&,differences,{2}];
 
{h1,h2,h3}={
 
Show[histograms1[[2]],PlotLabel->"n=1000, \[Tau]=2.2"],
 
Show[histograms1[[5]],PlotLabel->"n=1000, \[Tau]=2.5"],
 
Show[histograms1[[8]],PlotLabel->"n=1000, \[Tau]=2.8"]};
 
{h1zoomed,h2zoomed,h3zoomed}={
 
Show[histograms2[[2]],PlotLabel->"n=1000, \[Tau]=2.2"],
 
Show[histograms2[[5]],PlotLabel->"n=1000, \[Tau]=2.5"],
 
Show[histograms2[[8]],PlotLabel->"n=1000, \[Tau]=2.8"]};
 
hcol=GraphicsGrid[Transpose[{{h1,h2,h3},{h1zoomed,h2zoomed,h3zoomed}}]]
 

	
 

	
 
TableForm[histograms,TableHeadings->{taulabels,nlabels}]
 
Export[NotebookDirectory[]<>"plots/triangle_creation_frequencies_log.pdf",hcol]
0 comments (0 inline, 0 general)