cancel
Showing results for 
Search instead for 
Did you mean: 

Graph projection doesn't support String

yuxin16
Node Clone

Dear all,

I am currently facing problems of graph projection.
I used the example code of GDS_Retail_Demo from Alicia Frame for my own data set. But after running the louvain community I found out that no property (in my case: person's name) will be shown on the generated community graph. Then I was aware that my original node properties are not projected to my in-memory graph. Therefore, I would like to include them.

CALL gds.graph.create(
  'PersonTopicgraphWithProperties',                                
  {                                                     
    Person: {properties: 'FirstName'},                        
    Topic: {properties: 'Topic'}    
  },
  'HAS_SKILLS'                                                             
)
YIELD graphName, nodeProjection, nodeCount AS nodes, relationshipCount AS rels

My intention was to do person segmentation based on their skills or expertise.
But I then got the error message that the projection doesn't support String.

How should I deal with that? If the GDS Library doesn't support any String type label, how should I know who is assigned to which Louvain community then?

Thank you
Best Regards

2 REPLIES 2

If you want to see who is in each louvain community, you can join that with the results of your algorithm using gds.util.asNode:

CALL gds.louvain.stream('myGraph')
YIELD nodeId, communityId, intermediateCommunityIds
RETURN gds.util.asNode(nodeId).name AS name, communityId, intermediateCommunityIds
ORDER BY name ASC

what that will return is the string property - from the database - of name for each node id in your graph projection.

You can use a similar approach if you're exporting data, by specifying additionalNodeProperties (see Export operations - Neo4j Graph Data Science)

Wow thanks! It works!

But I currently have some upcoming questions:

  1. Does it mean that the properties I used for graph projection are the properties I used as algorithm inputs but not as node or relationship representation?
  2. Is there anyway I can show it like: If the node is customer, then show me the customerID, if the node is item, then show me item description. It seems that the other nodes will show as null. (e.g. if I want to show customer ID for customer nodes, then the customerID for items in the graph will be null; but if I do both, then both customer nodes and item nodes will have the same properties such as customerID and Description). How can I get rid of this?
  3. Thank you for the hints on exporting, since I was just troubling with the node names cannot be displayed in exported graph. But it seemed that I failed to do that.
    I first streamed the community with customerID shown:

    And I also wrote additionalNodeProperties for exporting the graph:

    But the new database still won't show the customerID:

    I then was wondering if I should write the customerID into the projected graph, but I failed by getting the error message:

    Where did I do wrong with that?

Thanks so much for help and sorry for so many upcoming questions.
Best Regards

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.