Skip to content

Instantly share code, notes, and snippets.

Last active January 27, 2021 13:21
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
A source code for a probability plots for a trustless Mimblewimble transaction aggregator based on scalable BFT
import matplotlib.pyplot as plt
def plotDistrib(prop, prob):
fig, ax = plt.subplots(1, 1, constrained_layout=True)
ax.set_title('cumulative distribution function')
ax.set_xlabel('Sybil Byzantine nodes [%]')
ax.plot(prop, prob)
from scipy.stats import hypergeom
from plotting import plotDistrib
def P(a, b, c, d):
return hypergeom.pmf(b, d+c, c, a+b)
def Pa(a, b, e, f, n):
return sum([P(a, b, x, n-x)*P(x, n-x, e, f) for x in range(n+1)])
def Pac(a_min, c, e, f, n):
return sum([Pa(a, c-a, e, f, n) for a in range(a_min, c+1)])
n = 200
nn = n*n
c = 36
c_min = 18
prop = []
prob = []
for f in range(1, nn, 1200):
x = f/nn
p = Pac(c_min, c, f, nn-f, n)
plotDistrib(prop, prob)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment