← Index
Wireframe In Progress

Notebook

Round 1 Created 2026-05-23 Section Analyze · Notebook
Desktop
AnalyzeNotebook Acme PMP — supply chain analysis
nb-204 · Python 3.13 · Piggie 0.8 · 12 cells · 8 code · 4 md · Last run 8 min ago
Created G. Felice · 2026-05-21
[1] code Python · ran 8m ago · 0.42s
# Pull Acme's neighborhood from the graph, depth 2 from piggie import connect from egan import entities, taxonomy p = connect("prod") acme = entities.get("acme-corp") nbrs = p.cypher(""" MATCH (org:Organization {id: $id})-[r*1..2]->(n) RETURN org, r, n """, id=acme.id).to_df()
out DataFrame · 247 rows × 6 cols · 12 ms
idxorg_idrelnode_idnode_typedepth
0acme-corpdepends_onsupplier-tier-1Organization1
1acme-corpdepends_onlogistics-partnerOrganization1
2acme-corpdepends_oncomponent-mfgOrganization1
3acme-corpenablesdistribution-netCapability1
4supplier-tier-1suppliesraw-material-xMaterial2
247 rows · memory 14.2 KB · partition prod.graph.manufacturing
[2] md Markdown · edited 14m ago

Approach

Pull the 2-hop neighborhood from Acme, then run pgvector similarity on the supplier nodes to surface accounts with comparable concentration risk. Cross-check against the peer-benchmark cohort (47 industrial-equipment manufacturers) to confirm we're seeing a category pattern, not an Acme idiosyncrasy.

Inputs

  • acme-corp — primary subject
  • industries.manufacturing — peer cohort filter
  • bm-122 — benchmark cohort id
[3] code Python · ran 6m ago · 1.84s
# Vector-similarity over supplier-tier-1 to find comparable accounts suppliers = nbrs[nbrs.node_type == "Organization"].node_id.unique() results = p.vector_search( index="acct_embeddings", query="supply chain concentration risk", k=10, filter={"industry": "manufacturing"}, ).to_df()
out DataFrame · 10 rows × 4 cols · 38 ms
rankaccountscoreindustry
1acme-corp0.98manufacturing
2globex-industries0.87manufacturing
3initech-holdings0.81manufacturing
4soylent-group0.76manufacturing
5stark-industrial0.72manufacturing
6wayne-mfg0.68manufacturing
[4] code Python · ran 4m ago · 218ms
# Plot supplier concentration distribution across the peer cohort from egan.benchmarks import cohort bm = cohort("bm-122") fig = bm.distribution(metric="supplier_concentration", highlight="acme-corp") fig.show()
out Figure · matplotlib · 480×220
supplier_concentration · n=47 · highlight: acme-corp
0.0 0.4 0.6 0.7 0.78 (acme) 0 10 20 n accounts
[5] code Python · ran 4m ago · 0.06s
# Hybrid: graph-traverse first, then vector-rank within result set hybrid = p.hybrid_search( graph="MATCH (o:Organization)-[:depends_on]->(s) RETURN s", vector_query="single-source dependency", vector_index="entity_embeddings", rerank_k=20, ).to_df() print(f"Returned {len(hybrid)} hybrid results")
out stdout · 0.06s
Hybrid query OK · graph stage 41ms · vector stage 18ms Returned 20 hybrid results
Add cell