I have a MultiDiGraph in networkx and I am thinking about exporting it to neo4j. I have already a property for the nodes called ntype and a property for the edges called dtype which fits with the label concept for nodes and edges for neo4j graphs.
Which elements from networkx might become labels at neo4j? How can it be managed?
I add an example of the graph at python and the graph I would like to get when exporting to neo4j.
Here is the code at python
import networkx as nx
G=nx.MultiDiGraph()
G.add_nodes_from([
(1,{'ntype':'NUMBER', 'color':'blue'}),
(2,{'ntype':'NUMBER', 'color':'yellow'}),
('A',{'ntype':'LETTER', 'state':'done'}),
('B',{'ntype':'LETTER', 'state':'pending'})
])
G.add_edges_from([
(1,'A','dir',{'etype':'IMPACTS', 'when':'old'}),
(1,'A','n_dir',{'etype':'IMPACTS', 'when':'new'}),
(1,'B','n_dir',{'etype':'ALTS', 'when':'future'}),
(2,'B','dir',{'etype':'IMPACTS', 'when':'new'}),
(2,'B','n_dir',{'etype':'IMPACTS', 'when':'old'}),
(2,'A','n_dir',{'etype':'ALTS', 'when':'new'}),
])
And here is the code at neo4j of the graph I would like to have when importing from networkx
CREATE (one:NUMBER {name:1, color:'blue'})
CREATE (two:NUMBER {name:2, color:'yellow'})
CREATE (A:LETTER {name:'A', state:'done'})
CREATE (B:LETTER {name:'B', state:'pending'})
CREATE (one)-[:IMPACTS {k:'dir', when:'old'}]->(A)
CREATE (one)-[:IMPACTS {k:'n_dir', when:'new'}]->(A)
CREATE (one)-[:IMPACTS {k:'n_dir', when:'future'}]->(B)
CREATE (two)-[:ALTS {k:'dir', when:'new'}]->(B)
CREATE (two)-[:IMPACTS {k:'n_dir', when:'old'}]->(B)
CREATE (two)-[:ALTS {k:'n_dir', when:'new'}]->(A)
I have tried exporting in networkx to graphml and importing in neo4j as described here enter link description here. I also added the parameters readLabels and storeNodeIds. From the browser:
CALL apoc.import.graphml("test.graphml", {readLabels: true, storeNodeIds:true})
Now I get the labels for the edges but I do not get the labels for the nodes. This is what I get:

