@scipyonly
@numpyonly
def test_linkage_tree():
    with util_numpy.test_uses_numpy() as np:
        s = np.array([[0.0, 0, 1, 2, 1, 0, 1, 0, 0], [0.0, 1, 2, 0, 0, 0, 0, 0, 0], [1.0, 2, 0, 0, 0, 0, 0, 1, 1], [0.0, 0, 1, 2, 1, 0, 1, 0, 0], [0.0, 1, 2, 0, 0, 0, 0, 0, 0], [1.0, 2, 0, 0, 0, 0, 0, 1, 1], [1.0, 2, 0, 0, 0, 0, 0, 1, 1]])
        model = clustering.LinkageTree(dtw.distance_matrix_fast, {})
        cluster_idx = model.fit(s)
        if directory:
            hierarchy_fn = os.path.join(directory, 'hierarchy.png')
            graphviz_fn = os.path.join(directory, 'hierarchy.dot')
        else:
            file = tempfile.NamedTemporaryFile()
            hierarchy_fn = (file.name + '_hierarchy.png')
            graphviz_fn = (file.name + '_hierarchy.dot')
        if (not dtwvis.test_without_visualization()):
            model.plot(hierarchy_fn)
            print('Figure saved to', hierarchy_fn)
        with open(graphviz_fn, 'w') as ofile:
            print(model.to_dot(), file=ofile)
        print('Dot saved to', graphviz_fn)
@scipyonly
@numpyonly
def test_linkage_tree():
    with util_numpy.test_uses_numpy() as np:
        s = np.array([[0.0, 0, 1, 2, 1, 0, 1, 0, 0], [0.0, 1, 2, 0, 0, 0, 0, 0, 0], [1.0, 2, 0, 0, 0, 0, 0, 1, 1], [0.0, 0, 1, 2, 1, 0, 1, 0, 0], [0.0, 1, 2, 0, 0, 0, 0, 0, 0], [1.0, 2, 0, 0, 0, 0, 0, 1, 1], [1.0, 2, 0, 0, 0, 0, 0, 1, 1]])
        model = clustering.LinkageTree(dtw.distance_matrix_fast, {})
        cluster_idx = model.fit(s)
        if directory:
            hierarchy_fn = os.path.join(directory, 'hierarchy.png')
            graphviz_fn = os.path.join(directory, 'hierarchy.dot')
        else:
            file = tempfile.NamedTemporaryFile()
            hierarchy_fn = (file.name + '_hierarchy.png')
            graphviz_fn = (file.name + '_hierarchy.dot')
        if (not dtwvis.test_without_visualization()):
            model.plot(hierarchy_fn)
            print('Figure saved to', hierarchy_fn)
        with open(graphviz_fn, 'w') as ofile:
            print(model.to_dot(), file=ofile)
        print('Dot saved to', graphviz_fn)