Ejemplo n.º 1
0
def test_SmallComplexNetwork():
    net = ResNetwork.SmallComplexNetwork()
    assert net.flagComplex

    adm = net.get_admittance()

    res = adm.real
    exp = [[0., 0.1, 0., 0., 0.], [0.1, 0., 0.0625, 0.25, 0.],
           [0., 0.0625, 0., 0.0625, 0.], [0., 0.25, 0.0625, 0., 0.05],
           [0., 0., 0., 0.05, 0.]]
    assert np.allclose(res, exp, atol=1e-04)

    res = adm.imag
    exp = [[0., -0.2, 0., 0., 0.], [-0.2, 0., -0.0625, -0.25, 0.],
           [0., -0.0625, 0., -0.0625, 0.], [0., -0.25, -0.0625, 0., -0.05],
           [0., 0., 0., -0.05, 0.]]
    assert np.allclose(res, exp, atol=1e-04)
Ejemplo n.º 2
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 SWIPO Project
#
# Authors (this file):
#   Stefan Schinkel <*****@*****.**>
"""
Weave tests to check that python and weave implementations give the same
results
"""

from pyunicorn import ResNetwork

res = ResNetwork.SmallTestNetwork()
resC = ResNetwork.SmallComplexNetwork()


def testVCFB():
    for i in range(5):
        res.flagWeave = False
        vcfbPython = res.vertex_current_flow_betweenness(i)
        res.flagWeave = True
        vcfbWeave = res.vertex_current_flow_betweenness(i)
        assert vcfbPython == vcfbWeave


def testECFB():
    res.flagWeave = False
    ecfbPython = res.edge_current_flow_betweenness()
    res.flagWeave = True