Reputation: 1288
Here is another basic question for some basic functionality of py2neo (v4) that does not work in the intuitive way.
How to get/print the list of existing relationship types?
In the documentation's graph section of the database page there is a method relationship_types
which supposedly returns "The set of relationship types currently defined within the graph.", and I expected it to work like this:
print(graph.relationship_types)
but I get the error 'Graph' object has no attribute 'relationship_types'
.
But if that's the case, what does have that attribute? There is no example of using this method on that page (or anywhere else I could find), and I am having trouble with a lot of the basic functionality of py2neo for similar reasons.
Upvotes: 1
Views: 644
Reputation: 178
for rel in grap.ralationships:
print('from:',rel.start_node)
print('to:',rel.end_node)
print('drum role.... ding ding ding Rel TYPE:',type(r).__name__)
list of types of rels:
set([type(r).__name__ for r in in graph.ralationships])
hope this helps some one
Upvotes: 2
Reputation: 1818
The property that you mentioned is not only in V4 but in V3 as well. Chances are that you are not using the property properly.
Here is a really simple example which works for me (v3.1.2). Same code is working on V4.1.0 too.
from py2neo import Graph
graph = Graph("http://localhost:7474", username="USERNAME", password="PASSWORD")
print(graph.relationship_types)
Upvotes: 0