Sha256: 01f8a04fd9be9baff59244dbe7308d56b36e5b0dada3570a7f369e698785858e

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

# -*- coding: utf-8 -*-
"""
Created on Mon Jun 13 11:46:53 2016

@author: devd
"""

from createRandomString import *
from makeGraph import *
import networkx as nx
import matplotlib.pyplot as plt

def experiment(numOnes, numStrings, length, reps):
    maxdeg = []
    mindeg = []
    for i in range(reps):
        strings = []
        for i in range(numStrings):
               strings.append(createRandomString(length, numOnes))
        graph = makeGraph(strings)
#        nx.draw(graph)
        max = min = graph.degree(0)
#        print 'initial max/min is {}'.format(max)
        for j in range(1, numStrings):
            deg = graph.degree(j)
#            print 'this one has degree {}'.format(deg)
            if deg>max:
                max = deg
            if deg<min:
                min = deg
        maxdeg.append(max)
        mindeg.append(min)
    
    return maxdeg, mindeg


def plot_it(numOnes, numStrings, length, reps):
    maxdeg, mindeg = experiment(numOnes, numStrings, length, reps)
    x = range(reps)
    print maxdeg
    print mindeg
    plt.plot(x, maxdeg)
    plt.plot(x, mindeg)
#    plt.show()
    

plot_it(5, 80, 32, 10)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mesh-rb-0.0.1 ext/mesh/mesh/theory/degcheck.py