I have a User class defined as below
class User
include Neo4j::ActiveNode
include Neo4j::Timestamps
property :user_id, type: Integer, constraint: :unique
property :max_friends_count, type: Integer, default: 5
validates :user_id, :presence => true
has_many :out, :followings, model_class: :GraphUser, rel_class: :GraphRel, unique: true
has_many :in, :followers, model_class: :GraphUser, rel_class: :GraphRel, unique: true
end
I have created user1
and user2
with user_id 1 and 2 respectively.
And then I dis search followings of followings using
user1.followings(rel_length: 2)
. But the result come out as user1
itself because both user1
and user2
are following each other.
I have tried order(:breadth_first)
and other methods to exclude the nodes that have already been visited. I might not have done enough research but does anyone have any idea how to do this?