How to get aggregated user count connected to the nodes and display it in graph using neovis

cypher

(Babu Ganesh0708) #1

Hi All,

I have created three nodes p1, p2, p3. Both p1 & p2 nodes are having label called "username" and for p3 node label is "Topic".

I have created the relationship called "interest" as like below,

Below is the query I tried,

LOAD CSV WITH HEADERS FROM "file:///email_logs.csv" AS row
MERGE (p1:Username {mail_id: row.sender})
MERGE (p2:Username {mail_id: row.recipient})
MERGE (p3:Topic {topic: row.keywords})
WITH p1, p2, p3, row, COUNT(*) AS count
MERGE (p1)-[rel:sent]->(p2)
MERGE (p1)-[int:interest]->(p3)<-[t:interest]-(p2)
SET int.count = count

Now I tried to get the list of users who are interested to the specific topic and below is the cypher query I executed,

MATCH (p1:Username)-[int:interest]->(p3:Topic)<-[:interest]-(p2:Username) WHERE(p3.topic STARTS WITH 'non compliances')
RETURN *

Below is the response from the browser,

Then I tried using neovis.js to make the graph edge thickness based on the count of each user interested to the specific topic but however I am unable to do it.

Example:- In the above screenshot the user "QQshhg" has interest of five times to the topic "non-compliance" and below is the function I created using neovis,

        function draw() {
            var config = {
                container_id: "viz",
                server_url: "bolt://localhost:7687",
				arrows: true,
                labels: {
                    "Username": {
                        "caption": "mail_id",
                    },
					"Topic": {
                        "caption": "topic",
                    }
                },
                relationships: {
					"interest": {
                        "thickness": "count",
                        "caption": false
                    }
                },
                initial_cypher: "MATCH (p1:Username)-[int:interest]->(p3:Topic)<-[:interest]-(p2:Username) WHERE(p3.topic STARTS WITH 'non compliances') RETURN * LIMIT 50"
            };

            viz = new NeoVis.default(config);
            viz.render();
        }

And below is the response I got from the neovis,

Please correct me if I am doing anything wrong and help me to understand it.

Thanks,
Ganeshbabu R


(Mark Needham) #2

It looks like it is plotting relationships with different thickness - can you check what the 'count' value is for the relationships between the users on the bottom and right of the diagram to the non compliances node?