Understand real life social network connections

Hi,
I’m new here, considering buying dgraph for our on-premise clients replacing orientdb.
In general, the need is to describe the connection between humans across social networks
human is the owner_of twitter/instagram/linkedin accounts.
the accounts are following other accounts that are owned by other humans.
in short:
humanA --owner_of--> twitterA --follows--> twitterB <--owner_of-- humanB.

I have in my hand human uid and I want to analyze and understand what other humans are connected to him (by removing un relevant nodes) and present it on my dashboard visualization.
In the following picture, I want to remove everything that is not marked in yellow.

Query 1 - known: human2. need to understand how other human/s are connected to him through bedirectional follows.

Query 2 - known: human4. need to understand how other human/s are connected to him through one direction follows.
(remove everything not marked in yellow.)

Link to the data: data generation

The schema

<dgraph.graphql.schema>: string .
<follows>: [uid] @reverse .
<name>: string .
<owner_of>: [uid] .

Thanks

Not sure If I got it.

Something like this?

{
  var(func: eq(name, "human2")) {
    level1 as owner_of
  }
  var(func: uid(level1)) @recurse(depth: 2) {
    _WhoFollowMe as <~follows>
    _WhoIFollow as follows
  }
  WhoFollowMe(func: uid(_WhoFollowMe)) @recurse(depth: 2) {
    name
  }
  WhoIFollow(func: uid(_WhoIFollow)) @recurse(depth: 2) {
    name
  }
}

Thats possible one way of doing it. I hadn’t seen the yellow, because I use f.lux, I didn’t notice the yellow. After I deactivated I realized more or less. You can use Normalize, but you need to see how (it’s a little late here in my time zone) there are some little rules to follow.

@MichelDiz thank you.
The result of the query really shows that you cant see the yellows :laughing:
Anyway, I have updated my question and added black lines.
I want to see in each query result, all the vertex and edges inside the black border. from the first human to others…

Thank you so much for your help.
Avi

Try this

{
  q(func: eq(name, "human1")) {
    name
    owner_of @filter(eq(name, "twitter1")) {
      name
      follows {
        name
      }
      followedBy : ~follows {
        name
       from: ~owner_of {
        name
      }
      }
    }
  }
}
{
  q(func: eq(name, "human3")) {
    name
    owner_of @filter(eq(name, "linkedin3")) {
      name
      follows {
        name
      }
      followedBy : ~follows {
        name
       from: ~owner_of {
        name
      }
      }
    }
  }
}

You could also combine with normalize

{
  q(func: eq(name, "human3")) {
    name
    owner_of @filter(eq(name, "linkedin3")) {
      name : name
      follows {
        name : name
      }
      followedBy : ~follows @normalize {
        name : name
        from : ~owner_of {
          from : name
        }
      }
    }
  }
}
{
  q(func: eq(name, "human1")) {
    name
    owner_of @filter(eq(name, "twitter1")) {
      name : name
      follows {
        name : name
      }
      followedBy : ~follows @normalize {
        name : name
        from : ~owner_of {
          from : name
        }
      }
    }
  }
}

Appreceated.
Will check and let you know.
Thanks

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.