10k Posts, 2 Tags, 1 Emoji.
Explore impact of :CONTAINS
rel on query.
Schema:
(:Emoji)<-[:CONTAINS]-(:Post)-[:CONTAINS]->(:Tag)
type alias Model = | |
{ screen : Screen | |
, hero : Hero | |
, foodPanel : FoodPanel | |
, hp : Hp | |
, score : Int | |
, bestResults : List BestResult | |
} |
Max De Marzi Modeling Guidelines:
Database Schema
CALL db.schema.visualization();
Graph Size
CALL apoc.meta.stats();
PROFILE MATCH (:Address {address: "addr1-2"})-[:OUT]->(:Output)<-[:OUT]-(t:Transaction) | |
CALL apoc.path.expandConfig(t, { sequence:'Transaction, <IN, Input, <UNLOCK, Output, <OUT' }) | |
YIELD path | |
UNWIND nodes(path) as tx | |
MATCH (tx:Transaction)-[:OUT]->(o:Output)<-[:OUT]-(a:Address) | |
WHERE (o)-[:UNLOCK]->(:Input) | |
RETURN DISTINCT * | |
// check tx chain, 3 - min number of hops in the chain, 6 - max | |
// where is no chains longer than 3 hops = 2 tx. (each (tx)-to->(tx) step required 3 hops). |
MATCH (n) DETACH DELETE n; | |
CREATE (b:Block {hash: 'block1'}); | |
// Coinbase 1 | |
MATCH (b:Block {hash: 'block1'}) | |
CREATE | |
(i:Input {coinbase: 'coinbase1'}), | |
(tx:Transaction {id: 'tx1-1'}), | |
(o:Output {n: 0, value: 11}), | |
(a:Address {address: 'addr1-1'}) |
FROM neo4j:4.0.0 | |
ENV APOC_VERSION=4.0.0.4 | |
ENV APOC_URI=https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/${APOC_VERSION}/apoc-${APOC_VERSION}-all.jar | |
ENV GDS_VERSION=1.0.0 | |
ENV GDS_URI=https://github.com/neo4j/graph-data-science/releases/download/${GDS_VERSION}/neo4j-graph-data-science-${GDS_VERSION}-standalone.jar | |
RUN apt-get update && apt-get install -y wget && rm -rf /var/lib/apt/lists/* | |
RUN wget $APOC_URI && mv apoc-${APOC_VERSION}-all.jar plugins/apoc-${APOC_VERSION}-all.jar |
PROFILE MATCH path = (t1:Transaction)-[:HOP*3..10]->(t2:Transaction) | |
WHERE (t1)<-[:OUT]-(:Client)-[:IN]->(t2) | |
AND t1.timestamp < t2.timestamp | |
AND (t1.amount - t2.amount) / t1.amount < 0.25 | |
UNWIND nodes(path) as t | |
MATCH (e)-[:OUT]->(t) | |
WHERE e:Client OR e:Company | |
RETURN e, t |
// clean up HOPS | |
CALL apoc.periodic.iterate( | |
"MATCH (:Transaction)-[r:HOP]->(:Transaction) RETURN r", | |
"DETACH DELETE r", | |
{ batchSize: 10000, parallel: false }); | |
// generate HOP relationships | |
CALL apoc.periodic.iterate( | |
"MATCH (t1:Transaction)<-[:IN]-(e)-[:OUT]->(t2:Transaction) | |
WHERE (e:Client OR e:Company) | |
AND t1.timestamp < t2.timestamp |