PyGraphistry AI
Doc routing (local + canonical)
- First route with
../pygraphistry/references/pygraphistry-readthedocs-toc.md.
- Use
../pygraphistry/references/pygraphistry-readthedocs-top-level.tsv for section-level shortcuts.
- Only scan
../pygraphistry/references/pygraphistry-readthedocs-sitemap.xml when a needed page is missing.
- Use one batched discovery read before deep-page reads; avoid
cat * and serial micro-reads.
- In user-facing answers, prefer canonical
https://pygraphistry.readthedocs.io/en/latest/... links.
Typical workflow
- Build graph from nodes/edges.
- Run feature/embedding method (
umap, embed, optional dbscan).
- Inspect derived columns/features and visualize.
- Iterate on feature columns and sampling strategy.
Baseline examples
# Similarity embedding / projection
g2 = graphistry.nodes(df, 'id').umap(X=['f1', 'f2', 'f3'])
g2.plot()
# Fit/transform flow for consistent projection on new batches
g_train = graphistry.nodes(df_train, 'id').umap(X=['f1', 'f2'])
g_batch = g_train.transform_umap(df_batch, return_graph=True)
g_batch.plot()
# Semantic search over embedded features
g2 = graphistry.nodes(df, 'id').umap(X=['text_col'])
results_df, query_vector = g2.search('suspicious login pattern')
# Text-first workflow: featurize then search/cluster
g2 = graphistry.nodes(df, 'id').featurize(kind='nodes', X=['title', 'body']).umap(kind='nodes').dbscan()
hits, qv = g2.search('credential stuffing campaign')
# Precomputed embedding columns
embedding_cols = [c for c in df.columns if c.startswith('emb_')]
g2 = graphistry.nodes(df, 'id').umap(X=embedding_cols)
g_new = g2.transform_umap(df_new, return_graph=True)
Practical guardrails
- Start with small/representative samples before full runs.
- Keep explicit feature lists (
X=...) for reproducibility.
- Track engine/dataframe type for CPU vs GPU behavior. Polars input is supported; use
engine='polars'/'polars-gpu' for GFQL row/traversal work when preserving a Polars result matters.
- UMAP, hypergraph, layout, and other whole-graph analytics are not native Polars operations. Under a Polars GFQL engine, use the default bridge knowingly or set
call_mode='strict' to reject off-engine execution.
- For anomaly workflows, document thresholds and false-positive assumptions.
- For graph ML tasks, route deeper model workflows to RGCN/link-prediction references.
- For text workflows, prefer
featurize(...).umap(...).search(...) when queries are natural language.
- If users already have embeddings, reuse them via explicit embedding column lists (
X=[...]) before recomputing.
- When user asks for a concise workflow snippet, prefer one short code block and avoid long narrative wrappers.
Canonical docs
1---2name: pygraphistry-ai3description: PyGraphistry graph ML/AI: UMAP, DBSCAN, embeddings, and anomaly detection workflows. Use when asked to "run UMAP on my graph", "cluster nodes", "find anomalies in my network data", "embed nodes", "fit-transform pipeline", "semantic search over graph nodes", or "graph AI". Also triggers on "graphistry umap", "dbscan clusters", "node embeddings", "featurize", or "anomaly triage". Proactively suggest when the user has node feature columns and asks about outliers, clusters, or similarity without yet using UMAP or DBSCAN.4---56# PyGraphistry AI78## Doc routing (local + canonical)9- First route with `../pygraphistry/references/pygraphistry-readthedocs-toc.md`.10- Use `../pygraphistry/references/pygraphistry-readthedocs-top-level.tsv` for section-level shortcuts.11- Only scan `../pygraphistry/references/pygraphistry-readthedocs-sitemap.xml` when a needed page is missing.12- Use one batched discovery read before deep-page reads; avoid `cat *` and serial micro-reads.13- In user-facing answers, prefer canonical `https://pygraphistry.readthedocs.io/en/latest/...` links.1415## Typical workflow161. Build graph from nodes/edges.172. Run feature/embedding method (`umap`, `embed`, optional `dbscan`).183. Inspect derived columns/features and visualize.194. Iterate on feature columns and sampling strategy.2021## Baseline examples22```python23# Similarity embedding / projection24g2 = graphistry.nodes(df, 'id').umap(X=['f1', 'f2', 'f3'])25g2.plot()26```2728```python29# Fit/transform flow for consistent projection on new batches30g_train = graphistry.nodes(df_train, 'id').umap(X=['f1', 'f2'])31g_batch = g_train.transform_umap(df_batch, return_graph=True)32g_batch.plot()33```3435```python36# Semantic search over embedded features37g2 = graphistry.nodes(df, 'id').umap(X=['text_col'])38results_df, query_vector = g2.search('suspicious login pattern')39```4041```python42# Text-first workflow: featurize then search/cluster43g2 = graphistry.nodes(df, 'id').featurize(kind='nodes', X=['title', 'body']).umap(kind='nodes').dbscan()44hits, qv = g2.search('credential stuffing campaign')45```4647```python48# Precomputed embedding columns49embedding_cols = [c for c in df.columns if c.startswith('emb_')]50g2 = graphistry.nodes(df, 'id').umap(X=embedding_cols)51g_new = g2.transform_umap(df_new, return_graph=True)52```5354## Practical guardrails55- Start with small/representative samples before full runs.56- Keep explicit feature lists (`X=...`) for reproducibility.57- Track engine/dataframe type for CPU vs GPU behavior. Polars input is supported; use `engine='polars'`/`'polars-gpu'` for GFQL row/traversal work when preserving a Polars result matters.58- UMAP, hypergraph, layout, and other whole-graph analytics are not native Polars operations. Under a Polars GFQL engine, use the default bridge knowingly or set `call_mode='strict'` to reject off-engine execution.59- For anomaly workflows, document thresholds and false-positive assumptions.60- For graph ML tasks, route deeper model workflows to RGCN/link-prediction references.61- For text workflows, prefer `featurize(...).umap(...).search(...)` when queries are natural language.62- If users already have embeddings, reuse them via explicit embedding column lists (`X=[...]`) before recomputing.63- When user asks for a concise workflow snippet, prefer one short code block and avoid long narrative wrappers.6465## Canonical docs66- GFQL + AI combos: https://pygraphistry.readthedocs.io/en/latest/gfql/combo.html67- API AI reference: https://pygraphistry.readthedocs.io/en/latest/api/ai.html68- AI notebook index: https://pygraphistry.readthedocs.io/en/latest/notebooks/ai.html69- Example RGCN notebook: https://pygraphistry.readthedocs.io/en/latest/demos/more_examples/graphistry_features/embed/simple-ssh-logs-rgcn-anomaly-detector.html