diff --git a/triangle_correlation_plots.m b/triangle_correlation_plots.m new file mode 100644 index 0000000000000000000000000000000000000000..7e3b2295970da5be90194d758b53c09841778121 --- /dev/null +++ b/triangle_correlation_plots.m @@ -0,0 +1,93 @@ +(* ::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] + + + diff --git a/triangle_spectrum_plots.m b/triangle_spectrum_plots.m index e525f1aa7a49ff7c4cda6e15d7c26d53a00a96b5..7b0ed5b396fe37e67b9b6249c597017a008cbb91 100644 --- a/triangle_spectrum_plots.m +++ b/triangle_spectrum_plots.m @@ -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]]]