Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
09-16-2020 06:39 AM
This is what I am trying to follow
CREATE CONSTRAINT ON (c:Customer) ASSERT c.id IS UNIQUE;
CREATE CONSTRAINT ON (m:Merchant) ASSERT m.id IS UNIQUE;
LOAD CSV WITH HEADERS FROM
"file:///bs140513_032310.csv" AS line
WITH line,
SPLIT(line.customer, "'") AS customerID,
SPLIT(line.merchant, "'") AS merchantID,
SPLIT(line.age, "'") AS customerAge,
SPLIT(line.gender, "'") AS customerGender,
SPLIT(line.category, "'") AS transCategory
MERGE (customer:Customer {id: customerID[1], age: customerAge[1], gender: customerGender[1]})
MERGE (merchant:Merchant {id: merchantID[1]})
CREATE (transaction:Transaction {amount: line.amount, fraud: line.fraud, category: transCategory[1], step: line.step})-[:WITH]->(merchant)
CREATE (customer)-[:PERFORMS]->(transaction);
MATCH (c1:Customer)-[:PERFORMS]->(t1:Transaction)-[:WITH]->(m1:Merchant)
WITH c1, m1
MERGE (p1:Placeholder {id: m1.id})
MATCH (c1:Customer)-[:PERFORMS]->(t1:Transaction)-[:WITH]->(m1:Merchant)
WITH c1, m1, count(*) as cnt
MERGE (p2:Placeholder {id:c1.id})
MATCH (c1:Customer)-[:PERFORMS]->(t1:Transaction)-[:WITH]->(m1:Merchant)
WITH c1, m1, count(*) as cnt
MATCH (p1:Placeholder {id:m1.id})
WITH c1, m1, p1, cnt
MATCH (p2:Placeholder {id: c1.id})
WITH c1, m1, p1, p2, cnt
CREATE (p2)-[:PAYS {cnt: cnt}]->(p1)
MATCH (c1:Customer)-[:PERFORMS]->(t1:Transaction)-[:WITH]->(m1:Merchant)
WITH c1, m1, count(*) as cnt
MATCH (p1:Placeholder {id:c1.id})
WITH c1, m1, p1, cnt
MATCH (p2:Placeholder {id: m1.id})
WITH c1, m1, p1, p2, cnt
CREATE (p1)-[:PAYS {cnt: cnt}]->(p2)
// Computing PageRank for placeholder nodes
CALL algo.pageRank('Placeholder', 'PAYS', {writeProperty: 'pagerank'})
// Viewing the PageRank results
MATCH (p:Placeholder)
RETURN p.id AS id, p.pagerank as pagerank
ORDER BY pagerank DESC
CALL algo.pageRank.stream('Placeholder', 'PAYS', {
iterations:20, dampingFactor:0.85, writeProperty: 'pagerank'
})
YIELD nodeId, score
// Computing the degree of each node
MATCH (p:Placeholder)
SET p.degree = apoc.node.degree(p, 'PAYS')
// Community detection using label propagation
CALL algo.beta.labelPropagation('Placeholder', 'PAYS', {write:true, writeProperty: "community", weightProperty: "cnt"})
MATCH (p:Placeholder)
RETURN p.id AS id, p.pagerank as pagerank, p.degree as degree, p.community as community
// Computing node similarity
CALL algo.nodeSimilarity('Placeholder', 'PAYS', {writeProperty: 'similarity'})
// Query to obtain the relationships of a particular customer node
match (c1:Customer)-[:PERFORMS]->(t1:Transaction)-[:WITH]->(m1:Merchant)
where c1.id = "C2054744914"
return c1, t1, m1
09-21-2020 12:16 PM
Hi Harsh, Welcome. Did you have a question?
10-01-2020 01:51 AM
Yes Joel. Firstly, thank you for being patient with me.
So, my question is that I am not able to use following queries:
CALL algo.pageRank('Placeholder', 'Payes', {writeProperty: 'pagerank'})
CALL algo.labelPropagation('Placeholder', 'Payes', 'OUTGOING', {write:true, partitionProperty: "community", weightProperty: "count"})
I am getting following error:
There is no procedure with the name algo.pageRank
registered for this database instance. Please ensure you've spelled the procedure name correctly and that the procedure is properly deployed.
There is no procedure with the name algo.labelPropagation
registered for this database instance. Please ensure you've spelled the procedure name correctly and that the procedure is properly deployed.
I tried desktop version and then sandbox environment too. I installed APOC and Graph Data Science Library. Not able to download Graph Algorithm library because it is greyed out. \
I have also tried current neo4j version and 3.17 version as well. Nothing seems to be working.
Can you please suggest me what should be the query?
This are the previous queries I ran before the one where I am stuck at.
Please let me know if you need anything else to replicate.
LOAD CSV WITH HEADERS FROM
"https://github.com/KrishnaBankar/Fraud-Detection-using-Neo4j-Graph-DB-and-Machine-Learning/blob/mast..." AS line
WITH line,
SPLIT(line.customer, "'") AS customerID,
SPLIT(line.merchant, "'") AS merchantID,
SPLIT(line.age, "'") AS customerAge,
SPLIT(line.gender, "'") AS customerGender,
SPLIT(line.category, "'") AS transCategory
MERGE (customer:Customer {id: 'customerID', age: 'customerAge', gender: 'customerGender',zipCode: 'zipcodeOri'})
MERGE (bank:Bank {id: 'merchantID', zipCode: 'merchantZip'})
CREATE (transaction:Transaction {amount: line.amount, fraud: line.fraud, category: 'transCategory', step: line.step})-[:WITH]->(bank)
CREATE (customer)-[:MAKE]->(transaction)
*** Create Relationships using below query ***
MATCH (c1:Customer)-[:MAKE]->(t1:Transaction)-[:WITH]->(b1:Bank) WITH c1, b1 MERGE (p1:Placeholder {id: b1.id})
MATCH (c1:Customer)-[:MAKE]->(t1:Transaction)-[:WITH]->(b1:Bank) WITH c1, b1 MERGE (p1:Placeholder {id: c1.id})
MATCH (c1:Customer)-[:MAKE]->(t1:Transaction)-[:WITH]->(b1:Bank) WITH c1, b1, count(*) as cnt MATCH (p1:Placeholder {id:c1.id}) WITH c1, b1, p1, cnt MATCH (p2:Placeholder {id: b1.id}) WITH c1, b1, p1, p2, cnt CREATE (p1)-[:Payes {cnt: cnt}]->(p2)
10-02-2020 03:04 AM
Hi Harsh,
in my little experience I've see the function pageRank and labelPropagation in GDS Graph Data Science Library.
I use desktop version and Neo4j version >= 4,0,1,
Have you consider to try an update test ?
ciao
Alessio
All the sessions of the conference are now available online