Exemple #1
0
def test_graph_to_circuit():
    keg_paths = glob("data/*.keg")
    ec_paths = glob("data/*.ec")
    for keg_path, ec_path in zip(keg_paths, ec_paths):
        g = keg_to_graph(keg_path)
        ec = ec_to_eulerian_circuit(ec_path)
        assert is_same_circuit(get_eulerian_circuit(g), ec)
Exemple #2
0
from algorithms import rebuild, get_eulerian_circuit
from convert import keg_to_graph
from useful import convert_edges_for_list_of_tuple

import networkx as nx
g1 = keg_to_graph("data/rebuild/2_1.keg")
x1 = rebuild(g1)
print("=====")
g2 = keg_to_graph("data/rebuild/2_2.keg")
x2 = rebuild(g2)

i = x1[0]
for j in x2:
    nodes_eq = (sorted(i.nodes(data=True)) == sorted(j.nodes(data=True)))
    edges_eq = (sorted(convert_edges_for_list_of_tuple(
        i.edges(data=True))) == sorted(
            convert_edges_for_list_of_tuple(j.edges(data=True))))
    if nodes_eq and edges_eq:
        return True
    else:
        return False
Exemple #3
0
from algorithms import integration_nodes
from convert import keg_to_graph
from useful import convert_edges_for_list_of_tuple, print_graph

import networkx as nx
g = keg_to_graph("data/integration/1_1.keg")
x = integration_nodes(g)
# print_graph(x)
Exemple #4
0
def test_del_null_nodes():
    g1 = keg_to_graph("data/eq/null/1_1.keg")
    g2 = keg_to_graph("data/eq/null/1_2.keg")
    assert is_same_graph(dell_null_node(g1), g2)
Exemple #5
0
def test_is_same_graph():
    g1 = keg_to_graph("data/is_same_graph/1_1.keg")
    g2 = keg_to_graph("data/is_same_graph/1_2.keg")
    assert is_same_graph(g1, g2)