Is there a way I can use Weakly Connected Components with Dgraph

To facilitate better answering of questions, if you have a question, please fill in the following info. Otherwise, please delete the template.

I want to retrieve all subgraphs of the original graph where all vertices are connected to each other by some path, ignoring the direction of edges. e.g. I have 200 nodes with 20 nodes connected with each other making 10 components. So I want to retrieve 10 subgraphs showing which 20 nodes are connected.

Hey @mehak

We currently do not have built in graph algorithms. It’s a feature request that is pretty hot, so we will implement a library of them soon (ish).

1 Like

Are you aware of any workaround that I can implement on top of graph in Python to achieve the results of Weakly Connected components.

You can get this from a regular Dgraph query. For example, I can run this example query (from the term matching docs):

{
  me(func: allofterms(name@en, "jones indiana")) {
    name@en
    genre {
      name@en
    }
  }
}

And you can get the connected components in the query results. The visualization looks like this:

1 Like