Skip to content

Instantly share code, notes, and snippets.

@jexp
Last active May 30, 2025 00:27
Show Gist options
  • Save jexp/8d991d1e543c5a576a3f1ee70132ce71 to your computer and use it in GitHub Desktop.
Save jexp/8d991d1e543c5a576a3f1ee70132ce71 to your computer and use it in GitHub Desktop.

Revisions

  1. jexp revised this gist May 30, 2025. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion load_circuit.cypher
    Original file line number Diff line number Diff line change
    @@ -27,4 +27,11 @@ call (links) {
    match (s:Node {node_id:l.source})
    match (t:Node {node_id:l.target})
    create (s)-[:ACTIVATES {weight:l.weight}]->(t)
    }
    };

    MATCH p=()-[r:ACTIVATES]->() WITH r.weight as w
    return percentileDisc(w,0.95);

    match p1=(s:SuperNode)<-[:PART_OF]-(n)
    match p2=(n)-[r:ACTIVATES]-(m) where r.weight > 0.5
    return p1,p2;
  2. jexp revised this gist May 30, 2025. 1 changed file with 30 additions and 0 deletions.
    30 changes: 30 additions & 0 deletions load_circuit.cypher
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    create index for (n:Node) on (n.jsNodeId);
    create constraint for (n:Node) require (n.node_id) is unique;

    with "https://gist.github.com/jexp/8d991d1e543c5a576a3f1ee70132ce71/raw/medical-diagnosis.json" as url
    call apoc.load.json(url) yield value as v
    with v.metadata as metadata, v.links as links, v.qParams as qParams, v.nodes as nodes
    merge (m:Metadata {id: metadata.slug + ":" +metadata.scan})
    on create set m += metadata
    merge (m)-[:PARAMS]->(q:QParams)
    on create set q += qParams {.linkType, .pinnedIds,.clickedId, .sg_pos}
    with *
    call (nodes) {
    unwind nodes as n
    merge (node:Node {node_id:n.node_id})
    on create set node += n
    }
    call (qParams) {
    unwind qParams.supernodes as s
    merge (sn:SuperNode {name:s[0]}) // on create set s.ids = s[1..]
    with *
    unwind s[1..] as sId
    match (n:Node {jsNodeId:sId})
    merge (sn)<-[:PART_OF]-(n)
    }
    call (links) {
    unwind links as l
    match (s:Node {node_id:l.source})
    match (t:Node {node_id:l.target})
    create (s)-[:ACTIVATES {weight:l.weight}]->(t)
    }
  3. jexp created this gist May 29, 2025.
    16,324 changes: 16,324 additions & 0 deletions medical-diagnosis.json
    16,324 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.