Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def bolt_graph_to_edges_dataframe(graph):
import pandas as pd
df = pd.DataFrame([
util.merge_two_dicts(
{ key: value for (key, value) in relationship.items() },
{
relationship_id_key: relationship.id,
relationship_type_key: relationship.type,
start_node_id_key: relationship.start_node.id,
end_node_id_key: relationship.end_node.id
}
)
for relationship in graph.relationships
])
return stringify_neotimes(df)
def bolt_graph_to_nodes_dataframe(graph):
import pandas as pd
df = pd.DataFrame([
util.merge_two_dicts(
{ key: value for (key, value) in node.items() },
util.merge_two_dicts(
{
node_id_key: node.id,
node_type_key: ",".join(sorted([str(label) for label in node.labels]))
},
{ node_label_prefix_key + str(label): True for label in node.labels }))
for node in graph.nodes
])
return stringify_neotimes(df)
def bolt_graph_to_nodes_dataframe(graph):
import pandas as pd
df = pd.DataFrame([
util.merge_two_dicts(
{ key: value for (key, value) in node.items() },
util.merge_two_dicts(
{
node_id_key: node.id,
node_type_key: ",".join(sorted([str(label) for label in node.labels]))
},
{ node_label_prefix_key + str(label): True for label in node.labels }))
for node in graph.nodes
])
return stringify_neotimes(df)