Changeset - 73c8d2811bea
[Not reviewed]
0 1 1
Tom Bannink - 8 years ago 2017-06-28 17:44:57
tom.bannink@cwi.nl
Add some correlation plots
2 files changed with 115 insertions and 2 deletions:
0 comments (0 inline, 0 general)
triangle_correlation_plots.m
Show inline comments
 
new file 100644
 
(* ::Package:: *)
 

	
 
Needs["ErrorBarPlots`"]
 

	
 

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

	
 

	
 
gsraw=Import[NotebookDirectory[]<>"data/graphdata_properties.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: avgTriangles
 
3: edges
 
4: dstn
 
5: { HH A, HH L, average A, average L }  where for each there is (average of) {lambda1 , lambda1 - lambda2, lambda1/lambda2}
 
6: switching successrate after mixing
 
7: initial HH triangles
 
*)
 
nlabels=Map["n = "<>ToString[#]&,gdata[[1,All,1,1,1]]];
 
taulabels=Map["\[Tau] = "<>ToString[#]&,gdata[[All,1,1,1,2]]];
 
datatypeLabels={"(n,tau)","average number of triangles","edges","DSTN","Eigenvalues","successrate","initial number of triangles"};
 

	
 

	
 
(* ::Section:: *)
 
(*Plot triangle counts vs dsp*)
 

	
 

	
 
(* ::Subsection:: *)
 
(*Plot #trianges vs some degree-sequence-property*)
 

	
 

	
 
allPlots=Map[Show[
 
ListPlot[#[[All,{2,4}]],
 
AxesOrigin->{0,0},
 
Frame->True,FrameLabel->{"average number of triangles","degree-sequence-property"},
 
AspectRatio->Automatic,
 
ImageSize->Automatic,
 
PlotLabel->"n = "<>ToString[#[[1,1,1]]]<>" , \[Tau] = "<>ToString[#[[1,1,2]]],
 
PlotStyle->Black
 
],Plot[x,{x,1,10000}]]
 
&,gdata,{2}]
 

	
 

	
 
plotgrid=GraphicsRow[{GraphicsColumn[allPlots[[{1,2},1]]],allPlots[[3,1]]},Spacings->0,ImageSize->600]
 

	
 

	
 
(* ::Section:: *)
 
(*DSP, Edges, #triangles, successrate*)
 

	
 

	
 
(* datatype index:
 
1: {n,tau}
 
2: avgTriangles
 
3: edges
 
4: dstn
 
5: { HH A, HH L, average A, average L }  where for each there is (average of) {lambda1 , lambda1 - lambda2, lambda1/lambda2}
 
6: switching successrate after mixing
 
7: initial HH triangles
 
*)
 

	
 

	
 
correlations={4,2};
 

	
 
tauChoices={2,5,8};
 
nChoice=-1;
 

	
 
combiPlot=Show[
 
ListLogLogPlot[gdata[[tauChoices,nChoice,All,correlations]],
 
(*AxesOrigin->{0,0},*)
 
(*PlotRange\[Rule]{{0,3000},{0,3000}},*)
 
PlotRange->Automatic,
 
Frame->True,FrameLabel->datatypeLabels[[correlations]],
 
AspectRatio->Automatic,
 
ImageSize->Automatic,
 
PlotLabel->"n = "<>ToString[gdata[[1,nChoice]][[1,1,1]]],
 
PlotLegends->taulabels[[tauChoices]]
 
],Plot[x,{x,1,10000},PlotStyle->Black]]
 

	
 
Map[DensityHistogram[gdata[[#,nChoice,All,correlations]],"Log",
 
Frame->True,FrameLabel->datatypeLabels[[correlations]],
 
PlotLabel->taulabels[[#]]
 
]
 
&,tauChoices]
 

	
 

	
 

	
triangle_spectrum_plots.m
Show inline comments
 
@@ -21,8 +21,28 @@ nlabels=Map["n = "<>ToString[#]&,gdata[[1,All,1,1,1]]];
 
taulabels=Map["\[Tau] = "<>ToString[#]&,gdata[[All,1,1,1,2]]];
 

	
 

	
 
Histogram[gdata[[1,1,All,5,3,1]]]
 
Histogram[gdata[[1,1,All,5,3,2]]]
 
histograms=Map[Histogram[#[[All,5,2,1]],{0,#[[1,1,1]],Automatic}]&,gdata,{2}];
 

	
 

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

	
 

	
 
initialLaplacianData=gdata[[All,All,All,5,2]];
 
mixedLaplacianData=gdata[[All,All,All,5,4]];
 
lmaxDifference=Map[#[[5,2,1]]-#[[5,4,1]]&,gdata,{3}];
 
lmaxRatio=Map[#[[5,2,1]]/#[[5,4,1]]&,gdata,{3}];
 
lgapDifference=Map[#[[5,2,2]]-#[[5,4,2]]&,gdata,{3}];
 
lgapRatio=Map[#[[5,2,2]]/#[[5,4,2]]&,gdata,{3}];
 
lratioDifference=Map[#[[5,2,3]]-#[[5,4,3]]&,gdata,{3}];
 
lratioRatio=Map[#[[5,2,3]]/#[[5,4,3]]&,gdata,{3}];
 

	
 

	
 
Histogram[lmaxDifference[[1,1,All]]]
 
Histogram[lmaxRatio[[1,1,All]]]
 
Histogram[lgapDifference[[1,1,All]]]
 
Histogram[lgapRatio[[1,1,All]]]
 
Histogram[lratioDifference[[1,1,All]]]
 
Histogram[lratioRatio[[1,1,All]]]
 

	
 

	
 

	
0 comments (0 inline, 0 general)