Ejemplo n.º 1
0
def test():
    
    g = gr()
    g.dummyGraph()
    g.listEdges()
    g.listCardinality()
    return
Ejemplo n.º 2
0
def test():

    g = gr()
    g.dummyGraph()
    g.listEdges()
    g.listCardinality()
    return
Ejemplo n.º 3
0
def main(beg,end):
    myGraph = gr()
    #myGraph.dummyGraph()
    initGraph(myGraph)
    myGraph.verts[myGraph.vBN(beg)].pid[0].set_marker('x')
    myGraph.plt.margins(0.5)
    myGraph.setVi(myGraph.vBN(beg)) #set point A to be the starting point
    myGraph.setLabel(myGraph.vBN(beg), ['', 0, 'P']) #and set it to be permanant
    
    myGraph.plt.draw()
    myGraph.setEndpoint(myGraph.vBN(end)) # set E as the endpoint
    while myGraph.getLabel(myGraph.vBN(end))[2] != 'P': #untill E has a perm label...
        #sleep(0.25)
        if a(myGraph) or b(myGraph):
            continue
        else:
            break
    
    traceBack(myGraph.vBN(beg),myGraph.vBN(end), myGraph) #from the end, walk back to the start.
Ejemplo n.º 4
0
def main(beg, end):
    myGraph = gr()
    #myGraph.dummyGraph()
    initGraph(myGraph)
    myGraph.verts[myGraph.vBN(beg)].pid[0].set_marker('x')
    myGraph.plt.margins(0.5)
    myGraph.setVi(myGraph.vBN(beg))  #set point A to be the starting point
    myGraph.setLabel(myGraph.vBN(beg),
                     ['', 0, 'P'])  #and set it to be permanant

    myGraph.plt.draw()
    myGraph.setEndpoint(myGraph.vBN(end))  # set E as the endpoint
    while myGraph.getLabel(
            myGraph.vBN(end))[2] != 'P':  #untill E has a perm label...
        #sleep(0.25)
        if a(myGraph) or b(myGraph):
            continue
        else:
            break

    traceBack(myGraph.vBN(beg), myGraph.vBN(end),
              myGraph)  #from the end, walk back to the start.
Ejemplo n.º 5
0
            plt.savefig(f'plots/nodes/{title}_normal.png')

        plt.close()


if __name__ == "__main__":
    data_folder = 'data/'
    file_names = ['g1.csv', 'g2.csv', 'g3.csv']
    diff_threshold = 0.06

    save = True
    show = False

    for i in range(len(file_names)):
        name1 = file_names[i]
        g1 = gr()
        g1.load_from_file(f'{data_folder}/{name1}')
        for j in range(i + 1, len(file_names)):
            name2 = file_names[j]
            g2 = gr()
            g2.load_from_file(f'{data_folder}/{name2}')
            ns = NodeSimilarity(g1, g2, diff_threshold)

            title = f'{g1.name}_{g2.name}'
            print(f'______{title}______')
            print(
                f'{g1.name} has {len(g1.nodes)} nodes and {len(g1.edges)} edges'
            )
            print(
                f'{g2.name} has {len(g2.nodes)} nodes and {len(g2.edges)} edges'
            )