pygraphistry-core

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

PyGraphistry Core

PyGraphistry 核心功能

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.
  • 优先使用
    ../pygraphistry/references/pygraphistry-readthedocs-toc.md
    进行路由。
  • 使用
    ../pygraphistry/references/pygraphistry-readthedocs-top-level.tsv
    作为章节级快捷方式。
  • 仅在所需页面缺失时扫描
    ../pygraphistry/references/pygraphistry-readthedocs-sitemap.xml
  • 在深度页面读取前执行一次批量发现读取;避免使用
    cat *
    和串行微读取。
  • 在面向用户的回复中,优先使用规范的
    https://pygraphistry.readthedocs.io/en/latest/...
    链接。

Quick workflow

快速工作流

  1. Register to a Graphistry server.
  2. Build graph from edges/nodes (or hypergraph from wide rows).
  3. Bind visual columns as needed.
  4. Plot and iterate.
  1. 注册Graphistry服务器。
  2. 基于边/节点构建图(或基于宽行构建超图)。
  3. 根据需要绑定可视化列。
  4. 绘图并迭代优化。

Minimal baseline

最简基准代码

python
import os
import graphistry

graphistry.register(
    api=3,
    username=os.environ.get('GRAPHISTRY_USERNAME'),
    password=os.environ.get('GRAPHISTRY_PASSWORD')
)
python
import os
import graphistry

graphistry.register(
    api=3,
    username=os.environ.get('GRAPHISTRY_USERNAME'),
    password=os.environ.get('GRAPHISTRY_PASSWORD')
)

Auth variants (org + key flows)

认证变体(组织+密钥流程)

python
undefined
python
undefined

Organization-scoped login (SSO or user/pass org routing)

组织范围登录(SSO或用户名/密码组织路由)

graphistry.register(api=3, org_name=os.environ['GRAPHISTRY_ORG_NAME'], idp_name=os.environ.get('GRAPHISTRY_IDP_NAME'))

```python
graphistry.register(api=3, org_name=os.environ['GRAPHISTRY_ORG_NAME'], idp_name=os.environ.get('GRAPHISTRY_IDP_NAME'))

```python

Service account / personal key flow

服务账号/个人密钥流程

graphistry.register( api=3, personal_key_id=os.environ['GRAPHISTRY_PERSONAL_KEY_ID'], personal_key_secret=os.environ['GRAPHISTRY_PERSONAL_KEY_SECRET'] )

```python
graphistry.register( api=3, personal_key_id=os.environ['GRAPHISTRY_PERSONAL_KEY_ID'], personal_key_secret=os.environ['GRAPHISTRY_PERSONAL_KEY_SECRET'] )

```python

edges_df: src,dst,... and nodes_df: id,...

edges_df:包含src、dst等列;nodes_df:包含id等列

edges_df['type'] = edges_df.get('type', 'transaction') nodes_df['type'] = nodes_df.get('type', 'entity') g = graphistry.edges(edges_df, 'src', 'dst').nodes(nodes_df, 'id') g.plot()
undefined
edges_df['type'] = edges_df.get('type', 'transaction') nodes_df['type'] = nodes_df.get('type', 'entity') g = graphistry.edges(edges_df, 'src', 'dst').nodes(nodes_df, 'id') g.plot()
undefined

Hypergraph baseline

超图基准代码

python
undefined
python
undefined

Build graph from multiple entity columns in one table

从单表中的多个实体列构建图

hg = graphistry.hypergraph(df, ['actor', 'event', 'location']) hg['graph'].plot()
undefined
hg = graphistry.hypergraph(df, ['actor', 'event', 'location']) hg['graph'].plot()
undefined

ETL shaping checklist

ETL构建检查清单

  • Normalize identifier columns before binding (
    src/dst/id
    type consistency, null handling).
  • Prefer a plain
    type
    column on both edges and nodes for legend-friendly defaults and consistent category encodings.
  • Deduplicate high-volume repeated rows before first upload.
  • Materialize nodes for node-centric steps:
python
g = graphistry.edges(edges_df, 'src', 'dst').materialize_nodes()
  • 绑定前标准化标识符列(确保
    src/dst/id
    类型一致,处理空值)。
  • 建议在边和节点表中都添加一个普通的
    type
    列,以获得便于图例展示的默认设置和一致的类别编码。
  • 首次上传前对大量重复行进行去重。
  • 针对以节点为中心的操作,生成实体节点表:
python
g = graphistry.edges(edges_df, 'src', 'dst').materialize_nodes()

Practical checks

实用检查项

  • Confirm source/destination columns are non-null and correctly typed.
  • Materialize nodes if needed (
    g.materialize_nodes()
    ) before node-centric operations.
  • Start with smaller slices for first render on large data.
  • For neighborhood expansion and pattern mining, always use
    .gfql([...])
    or
    .gfql("MATCH ...")
    . The methods
    hop()
    and
    chain()
    are deprecated.
  • Keep credentials in environment variables only; do not hardcode usernames/passwords/tokens.
  • 确认源/目标列非空且类型正确。
  • 在执行以节点为中心的操作前,按需生成实体节点表(
    g.materialize_nodes()
    )。
  • 处理大数据时,先使用小数据片段进行首次渲染。
  • 进行邻域扩展和模式挖掘时,请始终使用
    .gfql([...])
    .gfql("MATCH ...")
    hop()
    chain()
    方法已被弃用。
  • 仅将凭证存储在环境变量中;请勿硬编码用户名/密码/令牌。

Canonical docs

规范文档