Esempio n. 1
0
def test_pseudo_sequence():
    # Test small valid pseudo sequence
    seq=[1000,3,3,3,3,2,2,2,1,1]
    assert_true(nx.is_pseudographical(seq))
    # Test for sequence with odd sum
    seq=[1000,3,3,3,3,2,2,2,1,1,1]
    assert_false(nx.is_pseudographical(seq))
    # Test for negative integer in sequence
    seq=[1000,3,3,3,3,2,2,-2,1,1]
    assert_false(nx.is_pseudographical(seq))
Esempio n. 2
0
def test_pseudo_sequence():
    # Test small valid pseudo sequence
    seq = [1000, 3, 3, 3, 3, 2, 2, 2, 1, 1]
    assert_true(nx.is_pseudographical(seq))
    # Test for sequence with odd sum
    seq = [1000, 3, 3, 3, 3, 2, 2, 2, 1, 1, 1]
    assert_false(nx.is_pseudographical(seq))
    # Test for negative integer in sequence
    seq = [1000, 3, 3, 3, 3, 2, 2, -2, 1, 1]
    assert_false(nx.is_pseudographical(seq))
Esempio n. 3
0
def test_pseudo_sequence():
    # Test small valid pseudo sequence
    seq = [1000, 3, 3, 3, 3, 2, 2, 2, 1, 1]
    assert nx.is_pseudographical(seq)
    # Test for sequence with odd sum
    seq = [1000, 3, 3, 3, 3, 2, 2, 2, 1, 1, 1]
    assert not nx.is_pseudographical(seq)
    # Test for negative integer in sequence
    seq = [1000, 3, 3, 3, 3, 2, 2, -2, 1, 1]
    assert not nx.is_pseudographical(seq)
    # Test for noninteger
    seq = [1, 1, 1.1, 1]
    assert not nx.is_pseudographical(seq)
    seq = [1, 1, "rer", 1]
    assert not nx.is_pseudographical(seq)
Esempio n. 4
0
    def show_result():
        m = path.get()

        #input user graph
        with open(m) as csvfile:  #read the csv file, row by row
            reader = csv.reader(csvfile)
            next(reader)
            source = []
            target = []
            value = []
            for row in reader:
                source.append(int(row[0]))
                target.append(int(row[1]))
                value.append(int(row[2]))

        util.create_graph(G, source, target, value)
        degrees = G.degree(G.nodes(), None)
        list_degrees = list(degrees)
        in_degree = G.in_degree(degrees)
        out_degree = G.out_degree(degrees)
        messagebox.showinfo(title='Result',
                            message=('the degrees of the nodes are:', degrees))
        if selection == "is_g":
            messagebox.showinfo(title='Result',
                                message=('the result of is_graphical:',
                                         nx.is_graphical(degrees)))
        elif selection == "is_d":
            messagebox.showinfo(title='Result',
                                message=('the result of is_digraphical:',
                                         nx.is_digraphical(
                                             in_degree, out_degree)))
        elif selection == "is_m":
            messagebox.showinfo(title='Result',
                                message=('the result of is_multigraphical:',
                                         nx.is_multigraphical(degrees)))
        elif selection == "is_p":
            messagebox.showinfo(title='Result',
                                message=('the result of is_psuedographical:',
                                         nx.is_pseudographical(degrees)))
        elif selection == "is_hh":
            messagebox.showinfo(
                title='Result',
                message=(
                    'the result of is_havel_hakimi:',
                    nx.is_valid_degree_sequence_havel_hakimi(list_degrees)))
        elif selection == "is_eg":
            messagebox.showinfo(
                title='Result',
                message=(
                    'the result of is_erdos=galli:',
                    nx.is_valid_degree_sequence_erdos_gallai(list_degrees)))

        util.draw_graph(G)