Skip to main content

gqlalchemy.transformations.translators.nx_translator

NetworkXCypherBuilder Objects

class NetworkXCypherBuilder()

yield_queries

def yield_queries(graph: nx.Graph) -> Iterator[str]

Generates Cypher queries for creating a graph.

yield_query_groups

def yield_query_groups(graph: nx.Graph) -> List[Iterator[str]]

Generates Cypher queries for creating a graph by query groups.

NxTranslator Objects

class NxTranslator(Translator)

Uses original ids from Memgraph. Labels are encoded as properties. Since Networkx allows that nodes have properties of different dimensionality, this modules makes use of it and stores properties as dictionary entries. All properties are saved to Networkx data structure.

to_cypher_queries

def to_cypher_queries(graph: nx.Graph,
config: NetworkXCypherConfig = None) -> Iterator[str]

Generates a Cypher query for creating a graph.

nx_graph_to_memgraph_parallel

def nx_graph_to_memgraph_parallel(graph: nx.Graph,
config: NetworkXCypherConfig = None) -> None

Generates Cypher queries and inserts data into Memgraph in parallel.

get_instance

def get_instance()

Creates Networx instance of the graph from the data residing inside Memgraph. Since Networkx doesn't support labels in a way Memgraph does, labels are encoded as a node and edge properties.