Skip to content

Instantly share code, notes, and snippets.

@Bowenislandsong
Created September 25, 2020 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bowenislandsong/ff004ebf7223140d03c2f15f59982931 to your computer and use it in GitHub Desktop.
Save Bowenislandsong/ff004ebf7223140d03c2f15f59982931 to your computer and use it in GitHub Desktop.
Set Reconciliation Graph
%% Graph IBLT
clear all
close all
t=csvread("./setDiff_iblt.txt");
i=csvread("./setDiff_intercpi.txt");
samples = 50;
dataLength = 50;
plotIBLTPerf_diff(t,i,samples,dataLength,"Communication and Time Cost vs. Diffrences Between 2 DB");
t=csvread("./setSize_iblt.txt");
i=csvread("./setSize_intercpi.txt");
samples = 50;
dataLength = 50;
plotIBLTPerf_setsize(t,i,samples,dataLength,"Communication and Time Cost vs. DB size");
function plotIBLTPerf_setsize(t,i,samp,dataLen,plotName)
[l,w]=size(t);
rt = reshape(t,[samp,l/samp,w]);
mrt = mean(rt,1);
setSize = mrt(:,:,1);
commCost = mrt(:,:,3);
timeCost = mrt(:,:,4);
ri = reshape(i,[samp,l/samp,w]);
mri = mean(ri,1);
icommCost = mri(:,:,3);
itimeCost = mri(:,:,4);
figure
hold on
xlabel("Database Size (number of entries)")
set(gca, 'XScale', 'log')
yyaxis left
set(gca, 'YScale', 'log')
ylabel("Total # of Bytes Transmited")
plot(setSize,setSize*dataLen,'-m','DisplayName','DB Size','LineWidth',2)
plot(setSize,commCost,'-k','DisplayName','IBLT Comm Cost','LineWidth',2)
plot(setSize,icommCost,'-b','DisplayName','InterCPI Comm Cost','LineWidth',2)
yyaxis right
set(gca, 'YScale', 'log')
ylabel("Time (s)")
plot(setSize,timeCost,'--g','DisplayName','IBLT Time','LineWidth',2)
plot(setSize,itimeCost,'--r','DisplayName','InterCPI Time','LineWidth',2)
title(plotName)
legend('Location',"northwest")
set(gca,'LineWidth',2);
set(gca,'Fontsize',20);
hold off
end
function plotIBLTPerf_diff(t,i,samp,dataLen,plotName)
[l,w]=size(t);
rt = reshape(t,[samp,l/samp,w]);
mrt = mean(rt,1);
setSize = mrt(:,:,1);
diff = mrt(:,:,2);
commCost = mrt(:,:,3);
timeCost = mrt(:,:,4);
successRate = mrt(:,:,5);
ri = reshape(i,[samp,l/samp,w]);
mri = mean(ri,1);
icommCost = mri(:,:,3);
itimeCost = mri(:,:,4);
figure
hold on
xlabel("Differences (number of symmetrical difference between 2 DBs)")
yyaxis left
ylabel("Total # of Bytes Transmited")
plot(diff,setSize*dataLen,'-m','DisplayName','DB Size','LineWidth',2)
plot(diff,commCost,'-k','DisplayName','IBLT Comm Cost','LineWidth',2)
plot(diff,icommCost,'-b','DisplayName','InterCPI Comm Cost','LineWidth',2)
yyaxis right
ylabel("Sync Time (s)")
plot(diff,timeCost,'--g','DisplayName','IBLT Time','LineWidth',2)
plot(diff,itimeCost,'--r','DisplayName','InterCPI Time','LineWidth',2)
title(plotName)
legend
legend('Location',"southeast")
set(gca,'LineWidth',2);
set(gca,'Fontsize',20);
hold off
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment