def con(location_file, file_path,limit=10):
    result = readLocationFile(location_file)
    #print result
    result = connected(result, connection_limit=limit)
    #print result
    generate_network_file(result, file_path, minus_one=False)
    network = Network()
    network.read(file_path)
    network.dot_gen(file_path + ".dot")
source_location = os.path.dirname(os.path.abspath(__file__)) + "/.."
sys.path.insert(0, source_location)

from aggregation_simulator.utils_configuration import get_test_files_directory, get_configuration
from aggregation_simulator.network import Network
from aggregation_async_simulator import run_simulation
from context_aggregator.utils_same import same

test_name1 = "test_network0"
d = os.path.join(get_test_files_directory(), test_name1)
network_file_path1 = os.path.join(d, test_name1 + ".txt")
simulation_root_dir = get_configuration("config.cfg", "TestDirectory", "simple_test_root_dir")

network = Network()
network.read(network_file_path1)
dot_file_path = os.path.join(d, network_file_path1 + ".dot")

#
# Code duplication from utils.py
#
def get_test_network(condition, network_name):
    d = get_test_files_directory()
    network_file = os.path.join(d, "%s/%s/%s.txt" % (condition, network_name, network_name))
    network = Network()
    network.read(network_file)
    return network

def runit(simulation_root_dir, network_file_path, sample_file_path, condition, test_sub_name, disconnection_rate = 0.0, drop_rate=0.0, threshold=sys.maxint):
    network_dir = make_ready_for_one_file_simulation(simulation_root_dir=simulation_root_dir,
                                                     network_file_path=network_file_path,
def get_test_network(condition, network_name):
    d = get_test_files_directory()
    network_file = os.path.join(d, "%s/%s/%s.txt" % (condition, network_name, network_name))
    network = Network()
    network.read(network_file)
    return network
 def test_dot_gen(self):
     network = Network()
     network.read(network_file_path)
     network.dot_gen(dot_file_path)