Beispiel #1
0
DATASET = "input/data"
src = 28
#FROVEDIS
try:
    argvs = sys.argv
    argc = len(argvs)
    if (argc < 2):
        print(
            'Please give frovedis_server calling command as the first argument \n(e.g. "mpirun -np 2 -x /opt/nec/nosupport/frovedis/ve/bin/frovedis_server")'
        )
        quit()
    FrovedisServer.initialize(argvs[1])

    frov_graph = fnx.read_edgelist(DATASET, nodetype=np.int32, delimiter=' ', \
                                       create_using=nx.DiGraph())
    fpath, fdist = fnx.single_source_shortest_path(frov_graph, src, \
                                                   return_distance=True)

    FrovedisServer.shut_down()
except Exception as e:
    print("status=Exception: " + str(e))
    sys.exit(1)

#NetworkX
try:
    nx_graph = nx.read_edgelist(DATASET, nodetype=np.int32, delimiter=' ', \
                                create_using=nx.DiGraph())
    npath = nx.single_source_shortest_path(nx_graph, src)
    ndist = {k: float(len(v) - 1) for k, v in npath.items()}
except Exception as e:
    print("status=Exception: " + str(e))
    sys.exit(1)
Beispiel #2
0
    quit()

source = 1

fname = 'input/cit-Patents_10.txt'

FrovedisServer.initialize(argvs[1])
#frov_graph = fnx.read_edgelist(fname, nodetype=np.int32)
frov_graph = fnx.read_edgelist(fname,
                               nodetype=np.int32,
                               create_using=nx.DiGraph())
frov_graph.debug_print()

#returns dict of lists containing shortest path from source to all other nodes
path, dist = fnx.single_source_shortest_path(frov_graph,
                                             source,
                                             return_distance=True,
                                             verbose=1)
print("Frovedis sssp traversal path: ")
print(list(path))
print("Frovedis sssp traversal distance from source: ")
print(dist)

#nx_graph = nx.read_edgelist(fname, nodetype=np.int32)
nx_graph = nx.read_edgelist(fname,
                            nodetype=np.int32,
                            create_using=nx.DiGraph())
ret = nx.single_source_shortest_path(nx_graph, source)
print("Networkx sssp traversal path: ")
print(ret)

frov_graph.release()