def main(): import argparse from galois.shmem import setActiveThreads parser = argparse.ArgumentParser() parser.add_argument("--startNode", type=int, default=0) parser.add_argument("--propertyName", type=str, default="NewProperty") parser.add_argument("--reportNode", type=int, default=1) parser.add_argument("--noverify", action="store_true", default=False) parser.add_argument("--cython", action="store_true", default=False) parser.add_argument("--threads", "-t", type=int, default=1) parser.add_argument("input", type=str) args = parser.parse_args() print("Using threads:", setActiveThreads(args.threads)) graph = PropertyGraph(args.input) if args.cython: cython_bfs(graph, args.startNode, args.propertyName) else: bfs_sync_pg(graph, args.startNode, args.propertyName) print("Node {}: {}".format( args.reportNode, graph.get_node_property(args.propertyName)[args.reportNode])) if not args.noverify: numNodeProperties = len(graph.node_schema()) newPropertyId = numNodeProperties - 1 if args.cython: cython_verify_bfs(graph, args.startNode, newPropertyId) else: verify_bfs(graph, args.startNode, newPropertyId)
def main(): import argparse parser = argparse.ArgumentParser() parser.add_argument("--algoType", type=str, default="push") parser.add_argument("--propertyName", type=str, default="NewProperty") parser.add_argument("--reportNode", type=int, default=1) parser.add_argument("--noverify", action="store_true", default=False) parser.add_argument("--threads", "-t", type=int, default=1) parser.add_argument("input", type=str) args = parser.parse_args() print("Using threads:", setActiveThreads(args.threads)) graph = PropertyGraph(args.input) if args.algoType == "push": cc_push_topo(graph, args.propertyName) else: cc_pull_topo(graph, args.propertyName) print("Node {}: {}".format(args.reportNode, graph.get_node_property(args.propertyName)[args.reportNode])) if not args.noverify: numNodeProperties = len(graph.node_schema()) newPropertyId = numNodeProperties - 1 verify_cc(graph, newPropertyId)
def main(): import argparse parser = argparse.ArgumentParser() parser.add_argument("--startNode", type=int, default=0) parser.add_argument("--propertyName", type=str, default="NewProperty") parser.add_argument("--edgeWeightProperty", type=str, required=True) parser.add_argument("--shift", type=int, default=6) parser.add_argument("--reportNode", type=int, default=1) parser.add_argument("--noverify", action="store_true", default=False) parser.add_argument("--threads", "-t", type=int, default=1) parser.add_argument("input", type=str) args = parser.parse_args() print("Using threads:", setActiveThreads(args.threads)) graph = PropertyGraph(args.input) sssp(graph, args.startNode, args.edgeWeightProperty, args.shift, args.propertyName) print("Node {}: {}".format( args.reportNode, graph.get_node_property(args.propertyName)[args.reportNode])) if not args.noverify: numNodeProperties = len(graph.node_schema()) newPropertyId = numNodeProperties - 1 verify_sssp(graph, args.startNode, newPropertyId)
def test_load_garbage_file(): fi = NamedTemporaryFile(delete=False) try: with fi: fi.write(b"Test") with pytest.raises(TsubaError): PropertyGraph(fi.name) finally: os.unlink(fi.name)
def main(): import argparse parser = argparse.ArgumentParser() parser.add_argument("--propertyName", type=str, default="NewProperty") parser.add_argument("--noverify", action="store_true", default=False) parser.add_argument("--threads", "-t", type=int, default=1) parser.add_argument("--kcore", "-k", type=int, default=100) parser.add_argument("--reportNode", type=int, default=0) parser.add_argument("input", type=str) args = parser.parse_args() print("Using threads:", setActiveThreads(args.threads)) graph = PropertyGraph(args.input) kcore_async(graph, args.kcore, args.propertyName) print("Node {}: {}".format( args.reportNode, graph.get_node_property(args.propertyName)[args.reportNode])) if not args.noverify: verify_kcore(graph, args.propertyName, args.kcore)
def main(): import argparse parser = argparse.ArgumentParser() parser.add_argument("--baseNode", type=int, default=0) parser.add_argument("--reportNode", type=int, default=1) parser.add_argument("--propertyName", type=str, default="NewProperty") parser.add_argument("--threads", "-t", type=int, default=1) parser.add_argument("input", type=str) args = parser.parse_args() print("Using threads:", setActiveThreads(args.threads)) g = PropertyGraph(args.input) timer = StatTimer("Jaccard (Property Graph) Numba") timer.start() jaccard(g, args.baseNode, args.propertyName) timer.stop() # del timer print("Node {}: {}".format( args.reportNode, g.get_node_property(args.propertyName)[args.reportNode]))
def main(): import argparse parser = argparse.ArgumentParser() parser.add_argument("--propertyName", type=str, default="NewProperty") parser.add_argument("--maxIterations", type=int, default=100) parser.add_argument("--tolerance", type=float, default=1.0e-3) parser.add_argument("--noverify", action="store_true", default=False) parser.add_argument("--printTopN", type=int, default=10) parser.add_argument("--threads", "-t", type=int, default=1) parser.add_argument("--reportNode", type=int, default=0) parser.add_argument("input", type=str) args = parser.parse_args() print("Using threads:", setActiveThreads(args.threads)) graph = PropertyGraph(args.input) pagerank_pull_sync_residual(graph, args.maxIterations, args.tolerance, args.propertyName) print("Node {}: {}".format(args.reportNode, graph.get_node_property(args.propertyName)[args.reportNode])) if not args.noverify: verify_pr(graph, args.propertyName, args.printTopN)
def property_graph(): g = PropertyGraph(get_input("propertygraphs/ldbc_003")) return g
def test_load_directory(): with pytest.raises(TsubaError): PropertyGraph("/tmp")
def test_load_invalid_path(): with pytest.raises(TsubaError): PropertyGraph("non-existent")