cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Gds.beta.graph.create.subgraph doesn't copy relationships when nodes are filtered

gigauser
Graph Buddy

What I tried like this:

  1. I made News--RootWord graph and added news_group property on News nodes by GDS Louvain.

  2. Project News--RootWord graph as 'news'.

  3. Create subgraph:

call gds.beta.graph.create.subgraph(
'newsGroup740',
'news',
'n.news_group=740',
'*'
)

It created a subgraph of 285 nodes and 0 relations.

  1. So I exported the "news" graph into a new graph in the neo4j server:

call gds.graph.export('news', {dbName:'news'})

and then browse the news group of 740(one of Louvain result group ids):

match (n:News)-[:FROM_NEWS]->(r:RootWord) where n.news_group=740
return n, r

It displayed thousands relationships of "FROM_NEWS" within the nodes of the news_group(740).

Would it be a bug or am I doing something wrong when I creat subgraph in memory?

Dongho.

1 ACCEPTED SOLUTION

I think that the issue is that you aren't exporting RootWord in your subgraph projection, and there are no relationships between News nodes.

You'll want to modify your subgraph projection:

CALL gds.beta.graph.create.subgraph(
  'newsGroup740',
  'news',
  'n:RootWord OR (n:News AND n.news_group=740)',
  '*'
)
YIELD graphName, fromGraphName, nodeCount, relationshipCount

That should load the news and rootWord nodes as well as the relationships between them.

View solution in original post

2 REPLIES 2

I think that the issue is that you aren't exporting RootWord in your subgraph projection, and there are no relationships between News nodes.

You'll want to modify your subgraph projection:

CALL gds.beta.graph.create.subgraph(
  'newsGroup740',
  'news',
  'n:RootWord OR (n:News AND n.news_group=740)',
  '*'
)
YIELD graphName, fromGraphName, nodeCount, relationshipCount

That should load the news and rootWord nodes as well as the relationships between them.

Oh, definitely I missed that part. Alicia, thanks again.
Subgraph is really good tool, I think I will use it a lot.

Dongho.