(* ::Package:: *)

Needs["ErrorBarPlots`"]


(* ::Section:: *)
(*Visualize graphs*)


gsraw=Import[NotebookDirectory[]<>"graphdata.m"];


ListPlot[gsraw[[2]],Joined->True,PlotRange->All,AxesLabel->{"Step","Triangles"}]


gs=Map[Graph[#,GraphLayout->"CircularEmbedding"]&,gsraw[[1]]];
gs2=Map[Graph[#,GraphLayout->Automatic]&,gsraw[[1]]];


Grid[Partition[gs,10],Frame->All]


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


gsraw=Import[NotebookDirectory[]<>"graphdata.m"];


Map[ListPlot[#[[2]],Joined->True,PlotRange->All]&,gsraw[[1;;3]]]


averages=Map[{#[[1]],Mean[#[[2,-1000;;-1]]]}&,gsraw];
averagesGrouped=GatherBy[averages,#[[1]]&];
averagesErrorBars=Map[
{{#[[1,1]],Mean[#[[All,2]]]},
ErrorBar[StandardDeviation[#[[All,2]]]/Sqrt[Length[#]]]
}&,averagesGrouped];


ErrorListPlot[averagesErrorBars,Joined->True,PlotMarkers->Automatic,AxesLabel->{"n","\[LeftAngleBracket]triangles\[RightAngleBracket]"}]
