def empty_graph(): global redis_graph redis_con = _brand_new_redis() redis_graph = Graph("G", redis_con)
def __init__(self): super(testGraphCreationFlow, self).__init__() global redis_graph redis_con = self.env.getConnection() redis_graph = Graph(GRAPH_ID, redis_con)
def __init__(self): self.env = Env(decodeResponses=True) global redis_graph global redis_con redis_con = self.env.getConnection() redis_graph = Graph(GRAPH_ID, redis_con)
def test07_transposed_multi_hop(self): redis_con = self.env.getConnection() g = Graph("tran_multi_hop", redis_con) # (a)-[R]->(b)-[R]->(c)<-[R]-(d)<-[R]-(e) a = Node(properties={"val": 'a'}) b = Node(properties={"val": 'b'}) c = Node(properties={"val": 'c'}) d = Node(properties={"val": 'd'}) e = Node(properties={"val": 'e'}) g.add_node(a) g.add_node(b) g.add_node(c) g.add_node(d) g.add_node(e) ab = Edge(a, "R", b) bc = Edge(b, "R", c) ed = Edge(e, "R", d) dc = Edge(d, "R", c) g.add_edge(ab) g.add_edge(bc) g.add_edge(ed) g.add_edge(dc) g.flush() q = """MATCH (a)-[*2]->(b)<-[*2]-(c) RETURN a.val, b.val, c.val ORDER BY a.val, b.val, c.val""" actual_result = g.query(q) expected_result = [['a', 'c', 'a'], ['a', 'c', 'e'], ['e', 'c', 'a'], ['e', 'c', 'e']] self.env.assertEquals(actual_result.result_set, expected_result)
def populate_cyclic_graph(self): global graph_with_cycle graph_with_cycle = Graph("H", redis_con) # Construct a graph with the form: # (v1)-[:E]->(v2)-[:E]->(v3), (v2)-[:E]->(v1) node_props = ['v1', 'v2', 'v3'] nodes = [] for idx, v in enumerate(node_props): node = Node(label="L", properties={"val": v}) nodes.append(node) graph_with_cycle.add_node(node) edge = Edge(nodes[0], "E", nodes[1]) graph_with_cycle.add_edge(edge) edge = Edge(nodes[1], "E", nodes[2]) graph_with_cycle.add_edge(edge) # Introduce a cycle between v2 and v1. edge = Edge(nodes[1], "E", nodes[0]) graph_with_cycle.add_edge(edge) graph_with_cycle.commit()
def create_simple(r: Redis): g = Graph('simple', r) v0 = Node(label='v0', properties={'name': 'v0'}) v1 = Node(label='v1', properties={'name': 'v1'}) v2 = Node(label='v2', properties={'name': 'v2'}) v3 = Node(label='v3', properties={'name': 'v3'}) v4 = Node(label='v4', properties={'name': 'v4'}) g.add_node(v0) g.add_node(v1) g.add_node(v2) g.add_node(v3) g.add_node(v4) e1 = Edge(v0, 'r0', v1, properties={'name': 'r0'}) e2 = Edge(v1, 'r1', v2, properties={'name': 'r1'}) e3 = Edge(v2, 'r0', v3, properties={'name': 'r0'}) e4 = Edge(v3, 'r1', v4, properties={'name': 'r1'}) g.add_edge(e1) g.add_edge(e2) g.add_edge(e3) g.add_edge(e4) g.commit() return g
def setUp(self): global redis_graph redis_graph = Graph(GRAPH_ID, redis_con) self.env.flush()
def __init__(self): global graph3 self.env = Env(decodeResponses=True) redis_con = self.env.getConnection() graph3 = Graph("G3", redis_con) self.populate_graph()
def populate_graph(self, graph_name): people = ["Roi", "Alon", "Ailon", "Boaz", "Tal", "Omri", "Ori"] countries = ["Israel", "USA", "Japan", "United Kingdom"] visits = [("Roi", "USA"), ("Alon", "Israel"), ("Ailon", "Japan"), ("Boaz", "United Kingdom")] redis_graph = Graph(graph_name, redis_con) if not redis_con.exists(graph_name): personNodes = {} countryNodes = {} # Create entities for p in people: person = Node(label="person", properties={"name": p}) redis_graph.add_node(person) personNodes[p] = person for p in countries: country = Node(label="country", properties={"name": p}) redis_graph.add_node(country) countryNodes[p] = country for v in visits: person = v[0] country = v[1] edge = Edge(personNodes[person], 'visit', countryNodes[country], properties={'purpose': 'pleasure'}) redis_graph.add_edge(edge) redis_graph.commit() # Delete nodes, to introduce deleted item within our datablock query = """MATCH (n:person) WHERE n.name = 'Roi' or n.name = 'Ailon' DELETE n""" redis_graph.query(query) query = """MATCH (n:country) WHERE n.name = 'USA' DELETE n""" redis_graph.query(query) # Create index. actual_result = redis_con.execute_command( "GRAPH.QUERY", graph_name, "CREATE INDEX ON :person(name)") actual_result = redis_con.execute_command( "GRAPH.QUERY", graph_name, "CREATE INDEX ON :country(name)") return redis_graph
if ref_start <= char_start and ref_end >= char_end: longest_match_exists = True break if not longest_match_exists: # print("adding match to longest") longest_matched_ents.append(matched_ent) return [t for t in longest_matched_ents if len(t[1]) > 3] if __name__ == "__main__": """ This script hammers RedisGraph """ Automata = loadAutomata() redis_graph = Graph('cord19medical', rg) num_sents = 0 # all_lists_processed=rediscluster_client.keys('processed_docs_stage3_tokenized*') all_lists_processed = rediscluster_client.keys( 'processed_docs_stage3_tokenized{1x3}') for each_item in all_lists_processed: sentences_list = rediscluster_client.smembers(each_item) for item in sentences_list: tokens = set(rediscluster_client.lrange(item, 0, -1)) tokens.difference_update(STOP_WORDS) tokens.difference_update(set(punctuation)) matched_ents = find_matches(" ".join(tokens), Automata) if len(matched_ents) < 1: log("Error matching sentence " + item) else:
def test_CRUD_replication(self): # create a simple graph env = self.env source_con = env.getConnection() replica_con = env.getSlaveConnection() # enable write commands on slave, required as all RedisGraph # commands are registered as write commands replica_con.config_set("slave-read-only", "no") # perform CRUD operations # create a simple graph graph = Graph(GRAPH_ID, source_con) replica = Graph(GRAPH_ID, replica_con) s = Node(label='L', properties={'id': 0, 'name': 'abcd'}) t = Node(label='L', properties={'id': 1, 'name': 'efgh'}) e = Edge(s, 'R', t) graph.add_node(s) graph.add_node(t) graph.add_edge(e) graph.flush() # create index q = "CREATE INDEX ON :L(id)" graph.query(q) # create full-text index q = "CALL db.idx.fulltext.createNodeIndex('L', 'name')" graph.query(q) # add fields to existing index q = "CALL db.idx.fulltext.createNodeIndex('L', 'title', 'desc')" graph.query(q) # create full-text index with index config q = "CALL db.idx.fulltext.createNodeIndex({label: 'L1', language: 'german', stopwords: ['a', 'b'] }, 'title', 'desc')" graph.query(q) # update entity q = "MATCH (n:L {id:1}) SET n.id = 2" graph.query(q) # delete entity q = "MATCH (n:L {id:0}) DELETE n" graph.query(q) # give replica some time to catch up time.sleep(1) # make sure index is available on replica q = "MATCH (s:L {id:2}) RETURN s.name" plan = graph.execution_plan(q) replica_plan = replica.execution_plan(q) env.assertIn("Index Scan", plan) self.env.assertEquals(replica_plan, plan) # issue query on both source and replica # make sure results are the same result = graph.query(q).result_set replica_result = replica.query(q).result_set self.env.assertEquals(replica_result, result) # make sure node count on both primary and replica is the same q = "MATCH (n) RETURN count(n)" result = graph.query(q).result_set replica_result = replica.query(q).result_set self.env.assertEquals(replica_result, result) # make sure nodes are in sync q = "MATCH (n) RETURN n ORDER BY n" result = graph.query(q).result_set replica_result = replica.query(q).result_set self.env.assertEquals(replica_result, result) # make sure both primary and replica have the same set of indexes q = "CALL db.indexes()" result = graph.query(q).result_set replica_result = replica.query(q).result_set self.env.assertEquals(replica_result, result) # drop fulltext index q = "CALL db.idx.fulltext.drop('L')" graph.query(q) # give replica some time to catch up time.sleep(1) # make sure both primary and replica have the same set of indexes q = "CALL db.indexes()" result = graph.query(q).result_set replica_result = replica.query(q).result_set self.env.assertEquals(replica_result, result)
def test06_bulk_insert(self): graphname = "bulk_inserted_graph" runner = CliRunner() csv_path = os.path.dirname(os.path.abspath( __file__)) + '/../../demo/social/resources/bulk_formatted/' res = runner.invoke(bulk_insert, [ '--nodes', csv_path + 'Person.csv', '--nodes', csv_path + 'Country.csv', '--relations', csv_path + 'KNOWS.csv', '--relations', csv_path + 'VISITED.csv', graphname ]) # The script should report 27 node creations and 56 edge creations self.env.assertEquals(res.exit_code, 0) self.env.assertIn('27 nodes created', res.output) self.env.assertIn('56 relations created', res.output) # Restart the server self.env.dumpAndReload() graph = Graph(graphname, redis_con) query_result = graph.query("""MATCH (p:Person) RETURN p.name, p.age, p.gender, p.status, ID(p) ORDER BY p.name""") # Verify that the Person label exists, has the correct attributes # and is properly populated expected_result = [['Ailon Velger', 32, 'male', 'married', 2], ['Alon Fital', 32, 'male', 'married', 1], ['Boaz Arad', 31, 'male', 'married', 4], ['Gal Derriere', 26, 'male', 'single', 11], ['Jane Chernomorin', 31, 'female', 'married', 8], ['Lucy Yanfital', 30, 'female', 'married', 7], ['Mor Yesharim', 31, 'female', 'married', 12], ['Noam Nativ', 34, 'male', 'single', 13], ['Omri Traub', 33, 'male', 'single', 5], ['Ori Laslo', 32, 'male', 'married', 3], ['Roi Lipman', 32, 'male', 'married', 0], ['Shelly Laslo Rooz', 31, 'female', 'married', 9], ['Tal Doron', 32, 'male', 'single', 6], [ 'Valerie Abigail Arad', 31, 'female', 'married', 10 ]] self.env.assertEquals(query_result.result_set, expected_result) # Verify that the Country label exists, has the correct attributes, and is properly populated query_result = graph.query( 'MATCH (c:Country) RETURN c.name, ID(c) ORDER BY c.name') expected_result = [['Andora', 21], ['Canada', 18], ['China', 19], ['Germany', 24], ['Greece', 17], ['Italy', 25], ['Japan', 16], ['Kazakhstan', 22], ['Netherlands', 20], ['Prague', 15], ['Russia', 23], ['Thailand', 26], ['USA', 14]] self.env.assertEquals(query_result.result_set, expected_result) # Validate that the expected relations and properties have been constructed query_result = graph.query( 'MATCH (a)-[e:KNOWS]->(b) RETURN a.name, e.relation, b.name ORDER BY e.relation, a.name, b.name' ) expected_result = [['Ailon Velger', 'friend', 'Noam Nativ'], ['Alon Fital', 'friend', 'Gal Derriere'], ['Alon Fital', 'friend', 'Mor Yesharim'], ['Boaz Arad', 'friend', 'Valerie Abigail Arad'], ['Roi Lipman', 'friend', 'Ailon Velger'], ['Roi Lipman', 'friend', 'Alon Fital'], ['Roi Lipman', 'friend', 'Boaz Arad'], ['Roi Lipman', 'friend', 'Omri Traub'], ['Roi Lipman', 'friend', 'Ori Laslo'], ['Roi Lipman', 'friend', 'Tal Doron'], ['Ailon Velger', 'married', 'Jane Chernomorin'], ['Alon Fital', 'married', 'Lucy Yanfital'], ['Ori Laslo', 'married', 'Shelly Laslo Rooz']] self.env.assertEquals(query_result.result_set, expected_result) query_result = graph.query( 'MATCH (a)-[e:VISITED]->(b) RETURN a.name, e.purpose, b.name ORDER BY e.purpose, a.name, b.name' ) expected_result = [['Alon Fital', 'business', 'Prague'], ['Alon Fital', 'business', 'USA'], ['Boaz Arad', 'business', 'Netherlands'], ['Boaz Arad', 'business', 'USA'], ['Gal Derriere', 'business', 'Netherlands'], ['Jane Chernomorin', 'business', 'USA'], ['Lucy Yanfital', 'business', 'USA'], ['Mor Yesharim', 'business', 'Germany'], ['Ori Laslo', 'business', 'China'], ['Ori Laslo', 'business', 'USA'], ['Roi Lipman', 'business', 'Prague'], ['Roi Lipman', 'business', 'USA'], ['Tal Doron', 'business', 'Japan'], ['Tal Doron', 'business', 'USA'], ['Alon Fital', 'pleasure', 'Greece'], ['Alon Fital', 'pleasure', 'Prague'], ['Alon Fital', 'pleasure', 'USA'], ['Boaz Arad', 'pleasure', 'Netherlands'], ['Boaz Arad', 'pleasure', 'USA'], ['Jane Chernomorin', 'pleasure', 'Greece'], ['Jane Chernomorin', 'pleasure', 'Netherlands'], ['Jane Chernomorin', 'pleasure', 'USA'], ['Lucy Yanfital', 'pleasure', 'Kazakhstan'], ['Lucy Yanfital', 'pleasure', 'Prague'], ['Lucy Yanfital', 'pleasure', 'USA'], ['Mor Yesharim', 'pleasure', 'Greece'], ['Mor Yesharim', 'pleasure', 'Italy'], ['Noam Nativ', 'pleasure', 'Germany'], ['Noam Nativ', 'pleasure', 'Netherlands'], ['Noam Nativ', 'pleasure', 'Thailand'], ['Omri Traub', 'pleasure', 'Andora'], ['Omri Traub', 'pleasure', 'Greece'], ['Omri Traub', 'pleasure', 'USA'], ['Ori Laslo', 'pleasure', 'Canada'], ['Roi Lipman', 'pleasure', 'Japan'], ['Roi Lipman', 'pleasure', 'Prague'], ['Shelly Laslo Rooz', 'pleasure', 'Canada'], ['Shelly Laslo Rooz', 'pleasure', 'China'], ['Shelly Laslo Rooz', 'pleasure', 'USA'], ['Tal Doron', 'pleasure', 'Andora'], ['Tal Doron', 'pleasure', 'USA'], ['Valerie Abigail Arad', 'pleasure', 'Netherlands'], ['Valerie Abigail Arad', 'pleasure', 'Russia']] self.env.assertEquals(query_result.result_set, expected_result)
def test04_repeated_edges(self): graph_names = ["repeated_edges", "{tag}_repeated_edges"] for graph_name in graph_names: graph = Graph(graph_name, redis_con) src = Node(label='p', properties={'name': 'src'}) dest = Node(label='p', properties={'name': 'dest'}) edge1 = Edge(src, 'e', dest, properties={'val': 1}) edge2 = Edge(src, 'e', dest, properties={'val': 2}) graph.add_node(src) graph.add_node(dest) graph.add_edge(edge1) graph.add_edge(edge2) graph.flush() # Verify the new edge q = """MATCH (a)-[e]->(b) RETURN e.val, a.name, b.name ORDER BY e.val""" actual_result = graph.query(q) expected_result = [[ edge1.properties['val'], src.properties['name'], dest.properties['name'] ], [ edge2.properties['val'], src.properties['name'], dest.properties['name'] ]] self.env.assertEquals(actual_result.result_set, expected_result) # Save RDB & Load from RDB self.env.dumpAndReload() # Verify that the latest edge was properly saved and loaded actual_result = graph.query(q) self.env.assertEquals(actual_result.result_set, expected_result)
def populate_graph(self, graph_name): redis_graph = Graph(graph_name, redis_con) # quick return if graph already exists if redis_con.exists(graph_name): return redis_graph people = ["Roi", "Alon", "Ailon", "Boaz", "Tal", "Omri", "Ori"] visits = [("Roi", "USA"), ("Alon", "Israel"), ("Ailon", "Japan"), ("Boaz", "United Kingdom")] countries = ["Israel", "USA", "Japan", "United Kingdom"] personNodes = {} countryNodes = {} # create nodes for p in people: person = Node(label="person", properties={ "name": p, "height": random.randint(160, 200) }) redis_graph.add_node(person) personNodes[p] = person for c in countries: country = Node(label="country", properties={ "name": c, "population": random.randint(100, 400) }) redis_graph.add_node(country) countryNodes[c] = country # create edges for v in visits: person = v[0] country = v[1] edge = Edge(personNodes[person], 'visit', countryNodes[country], properties={'purpose': 'pleasure'}) redis_graph.add_edge(edge) redis_graph.commit() # delete nodes, to introduce deleted entries within our datablock query = """MATCH (n:person) WHERE n.name = 'Roi' or n.name = 'Ailon' DELETE n""" redis_graph.query(query) query = """MATCH (n:country) WHERE n.name = 'USA' DELETE n""" redis_graph.query(query) # create indices redis_con.execute_command( "GRAPH.QUERY", graph_name, "CREATE INDEX FOR (p:Person) ON (p.name, p.height)") redis_con.execute_command( "GRAPH.QUERY", graph_name, "CREATE INDEX FOR (c:country) ON (c.name, c.population)") actual_result = redis_con.execute_command( "GRAPH.QUERY", graph_name, "CREATE INDEX FOR ()-[r:visit]-() ON (r.purpose)") actual_result = redis_con.execute_command( "GRAPH.QUERY", graph_name, "CALL db.idx.fulltext.createNodeIndex({label: 'person', stopwords: ['A', 'B'], language: 'english'}, 'text')" ) return redis_graph
import os import redis import subprocess from redisgraph import Graph from neo4j import GraphDatabase r = redis.Redis(host='localhost', port=6379) redis_graph = Graph('G', r) neo4j_driver = GraphDatabase.driver("bolt:localhost:7687", auth=("neo4j", "admin")) neo4j_session = neo4j_driver.session() def neo4j_query(tx, query): x = tx.run(query) return x.values() def neo4j_transaction(query): return neo4j_session.write_transaction(neo4j_query, query) def compare_edges(rg_edge, neo_edge): assert (rg_edge.relation == neo_edge.type) assert (rg_edge.properties == neo_edge._properties) def compare_nodes(rg_node, neo_node): assert (frozenset(rg_node.label) == neo_node.labels) assert (rg_node.properties == neo_node._properties)
import redis import operator import progressbar from stemming.porter2 import stem from redisgraph import Node, Edge, Graph REMOVE_CHARS = [',', '.', ':', '\'', '"', '/', '\n', '\t', '-', ';', '(', ')', '[', ']', '{', '}', '!', '@', '#', '$', '%', '^', '&', '*', '?'] r = redis.Redis(host='localhost', port=6379) redis_graph = Graph('autocomplete', r) # Load data. r.flushall() # Create Indecies: redis_graph.query("CREATE INDEX ON :word(value)") redis_graph.call_procedure("db.idx.fulltext.createNodeIndex", 'word', 'value') # Populate graph. with open("./data/words_alpha.txt") as file: content = file.read() words = content.split() words = [w.lower() for w in words if len(w) > 1] unique_words = set(words) max_node_count = len(unique_words) node_count = 0 with progressbar.ProgressBar(max_value=max_node_count) as bar: for word in unique_words: n = Node(label='word', properties={'value': word})
def test04_repeated_edges(self): graphname = "repeated_edges" g = Graph(graphname, redis_con) src = Node(label='p', properties={'name': 'src'}) dest = Node(label='p', properties={'name': 'dest'}) edge1 = Edge(src, 'e', dest, properties={'val': 1}) edge2 = Edge(src, 'e', dest, properties={'val': 2}) g.add_node(src) g.add_node(dest) g.add_edge(edge1) g.add_edge(edge2) g.commit() # Verify the new edge q = """MATCH (a)-[e]->(b) RETURN e.val, a.name, b.name ORDER BY e.val""" actual_result = g.query(q) expected_result = [[ edge1.properties['val'], src.properties['name'], dest.properties['name'] ], [ edge2.properties['val'], src.properties['name'], dest.properties['name'] ]] assert (actual_result.result_set == expected_result) # Save RDB & Load from RDB redis_con.execute_command("DEBUG", "RELOAD") # Verify that the latest edge was properly saved and loaded actual_result = g.query(q) assert (actual_result.result_set == expected_result)
def __init__(self): super(testRelationPattern, self).__init__() global redis_graph redis_con = self.env.getConnection() redis_graph = Graph(GRAPH_ID, redis_con) self.populate_graph()
def worstcase(r: Redis): g = Graph('simple_2', r) v0 = Node(properties={'name': 'v0'}) v1 = Node(properties={'name': 'v1'}) v2 = Node(properties={'name': 'v2'}) v3 = Node(properties={'name': 'v3'}) v4 = Node(properties={'name': 'v4'}) g.add_node(v0) g.add_node(v1) g.add_node(v2) g.add_node(v3) g.add_node(v4) e1 = Edge(v0, 'A', v1, properties={'name': 'r1'}) e2 = Edge(v1, 'A', v2, properties={'name': 'r2'}) e3 = Edge(v2, 'A', v0, properties={'name': 'r3'}) e4 = Edge(v0, 'B', v3, properties={'name': 'r5'}) e5 = Edge(v3, 'B', v0, properties={'name': 'r6'}) g.add_edge(e1) g.add_edge(e2) g.add_edge(e3) g.add_edge(e4) g.add_edge(e5) g.commit() return g
def test04_no_compaction_on_edges_delete(self): graph_name = "no_compaction_on_edges_delete" redis_graph = Graph(graph_name, redis_con) # Create 3 nodes meta keys redis_graph.query("UNWIND range(0,20) as i CREATE ()-[:R]->()") # Return all the edges, before and after saving & loading the RDB, and check equality query = "MATCH ()-[e]->() WITH e ORDER by id(e) return COLLECT(id(e))" expected_full_graph_nodes_id = redis_graph.query(query) # Delete 3 edges. redis_graph.query("MATCH ()-[e]->() WHERE id(e) IN [7,14,20] DELETE e") expected_nodes_id_after_delete = redis_graph.query(query) # Save RDB & Load from RDB redis_con.execute_command("DEBUG", "RELOAD") actual = redis_graph.query(query) # Validate no compaction, all IDs are the same self.env.assertEquals(expected_nodes_id_after_delete.result_set, actual.result_set) # Validate reuse of edges ids - create 3 edges. redis_graph.query("UNWIND range (0,2) as i CREATE ()-[:R]->()") actual = redis_graph.query(query) self.env.assertEquals(expected_full_graph_nodes_id.result_set, actual.result_set)
import redis import config from redisgraph import Graph r = redis.Redis(host=config.config()['host'], port=config.config()['port']) redis_graph = Graph('CORD19GRAPH', r) from automata.utils import * from common.utils import * def match_nodes(search_string, Automata=Automata): if not Automata: Automata = loadAutomata() nodes = set() matched_ents = find_matches(search_string, Automata) nodes = set([node[0] for node in matched_ents]) return list(nodes) def get_nodes(nodes): node_list = list() params = {'ids': nodes} query = """WITH $ids as ids MATCH (e:entity) where e.id in ids RETURN DISTINCT e.id,e.name,max(e.rank)""" result = redis_graph.query(query, params) # result.pretty_print() for record in result.result_set: node_list.append({ 'id': record[0], 'name': record[1],
def __init__(self, args): self.graph = args.graph self.redis = redis.Redis(args.host, args.port) self.client = Graph(self.graph, self.redis)
def __init__(self): self.env = Env() global redis_graph redis_con = self.env.getConnection() redis_graph = Graph("G", redis_con) self.populate_graph()
def __init__(self): self.env = Env() global redis_graph redis_con = self.env.getConnection() redis_graph = Graph(GRAPH_ID, redis_con)
def __init__(self): super(testPathFilter, self).__init__() global redis_graph redis_con = self.env.getConnection() redis_graph = Graph(GRAPH_ID, redis_con)
def __init__(self): super(testSelfPointingNode, self).__init__() global redis_graph redis_con = self.env.getConnection() redis_graph = Graph(GRAPH_ID, redis_con) self.populate_graph()
def setUp(self): global redis_graph redis_con = self.env.getConnection() redis_graph = Graph(social_utils.graph_name, redis_con) social_utils.populate_graph(redis_con, redis_graph) self.build_indices()
def __init__(self): global graph self.env = Env(decodeResponses=True) redis_con = self.env.getConnection() graph = Graph("TraversalConstruction", redis_con)
def __init__(self): self.env = Env(decodeResponses=True) global redis_graph redis_con = self.env.getConnection() redis_graph = Graph("G", redis_con) self.populate_graph()
def __init__(self): super(testGraphMixLabelsFlow, self).__init__() global redis_graph redis_con = self.env.getConnection() redis_graph = Graph("G", redis_con) self.populate_graph()