Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7789647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:21:36+00:00 2026-06-01T21:21:36+00:00

Apologies if this is a simple question, but I turn to the wisdom of

  • 0

Apologies if this is a simple question, but I turn to the wisdom of SO to get me over this bump 🙂

I’m using RoR 3.1.1 with the neography gem.

I currently have a neo4j graph of people nodes with relationships as “friends” connecting them. Given a specific person’s node, I’d like to page through results of their friends-of-friends (2nd degree nodes) 5 at a time. Right now, I use the following traversal code which gets me ALL of the friends-of-friends at once (it can take so long that it will cause a timeout):

    nodes = @neo.traverse(user_node,"nodes", {"order" => "breadth first",
                                          "uniqueness" => "node global",
                                          "relationships" => {"type"=> "friends", "direction" => "all"},
                                          "return filter" => {
                                            "language" => "javascript",
                                            "body" => 
                                            "position.length() == 2;"},
                                          "depth" => 2}) 

From the neo4j website (http://docs.neo4j.org/chunked/stable/rest-api-traverse.html#rest-api-creating-a-paged-traverser), it looks like there is already such a thing as paged traversals, but I don’t see any references to doing this from neography.

Could someone provide example code to show how to do this with neography if possible, how to do it without neography if necessary, or a work-around such as limiting the number of results returned from the example traversal I’m already doing? Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T21:21:38+00:00Added an answer on June 1, 2026 at 9:21 pm

    Could you use a Cypher query for this, http://docs.neo4j.org/chunked/snapshot/cypher-query-lang.html, like

    START n = node(0) Match n-[:friends]->()-[:friends]->fof RETURN fof SKIP 0 LIMIT 5
    

    for the first 5 friends?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Apologies if this is a simple question but googling hasn't been able to help
Apologies for probably simple question, I've read the docs and still can't get this
Apologies if this is a simple question, I'm still pretty new to this, but
I apologies for this being a very simple question but as a first time
Apologies if this is an overly simple question, but my searches are getting me
Firstly apologies if this is a really simple question but Git is absolutely brand
Apologies if this is simple question, but Im extremely worn down and though thinking
Apologies if this is a dumb question. In previous ASP.NET projects, I've been using
Apologies, this is a tragically simple question that will bore most of you. I
This is probably a simple one but I cant get my head around it.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.