Changeset - 5cec3a409ef3
[Not reviewed]
0 1 2
Tom Bannink - 8 years ago 2017-06-12 17:26:59
tombannink@gmail.com
Add triangle creation frequency plots
3 files changed with 85 insertions and 0 deletions:
0 comments (0 inline, 0 general)
triangle_analysis.m
Show inline comments
 
@@ -193,6 +193,10 @@ plotTimeEvol=ListPlot[coarseData,Joined->True,PlotRange->{0*minCount,maxCount},D
 
Export[NotebookDirectory[]<>"plots/timeevol.pdf",plotTimeEvol]
 

	
 

	
 
movingAvg=Map[MovingAverage[#[[2]],2000][[1;;-1;;skipPts]]-Mean[#[[2,-20000;;-1]]]&,selectedData[[1;;-1;;5]]];
 
plotMovingAvg=ListPlot[movingAvg,Joined->True,PlotRange->All,DataRange->{0,measureSkip*maxTime},Frame->True,FrameLabel->{"timesteps","number of triangles"}]
 

	
 

	
 
(* ::Subsection:: *)
 
(*Plot success rate over "time"*)
 

	
triangle_creation_frequency_plots.m
Show inline comments
 
new file 100644
 
(* ::Package:: *)
 

	
 
Needs["ErrorBarPlots`"]
 

	
 

	
 
(* ::Section:: *)
 
(*Data import*)
 

	
 

	
 
gsraw=Import[NotebookDirectory[]<>"data/graphdata_timeevol.m"];
 
(* gsraw=SortBy[gsraw,{#[[1,1]]&,#[[1,2]]&}]; (* Sort by n and then by tau. The {} forces a *stable* sort because otherwise Mathematica sorts also on triangle count and other things. *) *)
 

	
 

	
 
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
 
*)
 
nlabels=Map["n = "<>ToString[#]&,gdata[[1,All,1,1,1]]];
 
taulabels=Map["tau = "<>ToString[#]&,gdata[[All,1,1,1,2]]];
 

	
 

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

	
 

	
 
(* ::Subsection:: *)
 
(*Plot triangle count over "time" in Markov chain instances*)
 

	
 

	
 
numPlots=20;
 
selectedData=gdata[[1,1]][[-numPlots;;-1]];
 
measureSkip=1;
 
minCount=Min[Map[Min[#[[2]]]&,selectedData]];
 
maxCount=Max[Map[Max[#[[2]]]&,selectedData]];
 
maxTime=Max[Map[Length[#[[2]]]&,selectedData]];
 
(* maxTime=30000; *)
 
skipPts=Max[1,Round[maxTime/500]]; (* Plotting every point is slow. Plot only once per `skipPts` timesteps *)
 
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}];
 

	
 

	
 
(* Take three runs of each *)
 
histograms=Map[Histogram[#[[{1,6,11,16}]],{-20,20,1},"LogCount",ImageSize->300]&,differences,{2}];
 

	
 

	
 
TableForm[histograms,TableHeadings->{taulabels,nlabels}]
triangle_spectrum_plots.m
Show inline comments
 
new file 100644
 
(* ::Package:: *)
 

	
 
gsraw=Import[NotebookDirectory[]<>"cpp/graphdata_spectrum.m"];
 
(* gsraw=SortBy[gsraw,{#[[1,1]]&,#[[1,2]]&}]; (* Sort by n and then by tau. The {} forces a *stable* sort because otherwise Mathematica sorts also on triangle count and other things. *) *)
 

	
 

	
 
gdata=GatherBy[gsraw,{#[[1,2]]&,#[[1,1]]&}];
 
(* Data format: *)
 
(* gdata[[ tau index, n index, run index , datatype index ]] *)
 
(* datatype index:
 
1: {n,tau}
 
2: etmt
 
*)
 
tauvalues=gdata[[All,1,1,1,2]];
 
nlabels=Map["n = "<>ToString[#]&,gdata[[1,All,1,1,1]]];
 
taulabels=Map["\[Tau] = "<>ToString[#]&,gdata[[All,1,1,1,2]]];
 

	
 

	
 
ListPlot[gdata[[1,1,1,{4,6}]]]
 
ListPlot[gdata[[1,1,1,{5,7}]]]
 

	
 

	
 
Histogram[gdata[[1,1,1,{4,6}]],50]
 
Histogram[gdata[[1,1,1,{5,7}]],50]
 

	
 

	
 

	
0 comments (0 inline, 0 general)