This is what I believe to be a very simple question. I am trying to recreate the graph on this page (scroll down a bit):
https://linkurio.us/visualizing-network-donald-trump/
There is code to create the graph on this page but I am trying to use the py2neo equivalent. I have successfully created these same graphs in NetworkX using a syntax similar to the below code but the below code is generating something quite different. My hope is to get code that will create a proper graph in proper py2neo form from CSV files. Note that I have searched for answers and I have reviewed this link already and not sure I follow: Creating neo4j graph database from csv file using py2neo.
The below code works fine (otherwise) and I am using the latest editions of py2neo and Neo4j (CE). I prefer simple code (generators, list comprehensions, etc., may not best) but will take whatever I can get. Just so it is clear, I am reading a CSV file, reading out columns called "Organization", "Person" and "Connection" and using those values in order to create a graph showing connections as in the above link. Thank you!
Code I am using:
def readCSV_forNeo4j_Trump(path):
with open(path + '/Trump/TrumpWorldData_Person-Org.csv', ncoding='utf8') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
Organization = row['Organization']
Person = row['Person']
Connection = row['Connection']
Person_Node = Node("Person", name=Person)
graph.create(Person_Node)
Org_Node = Node("Organization", name=Organization)
graph.create(Org_Node)
Person_Org = Relationship(Person_Node, Connection, Org_Node)
graph.create(Person_Org)