Google Cloud Solution Graph Ml

google/skills/skills/cloud/google-cloud-solution-graph-ml

by google751b947a5749b27eb3d2b8bcd1aa4bdb6fa0f426No license25K starsListed Dec 5, 2026Updated Dec 5, 2026Repository updated today

Orchestrates end-to-end Graph Machine Learning (GNN) solutions on Google Cloud, integrating Knowledge Catalog discovery (Dataplex, Collibra), BigQuery and Spanner Property Graph staging and readiness auditing, Distributed Graph Flow (dgf) pipeline synthesis, and Colab Enterprise training. Use when evaluating graph vs. tabular ML, staging enterprise sources (Drive, SharePoint, Salesforce, CSVs) into graphs, mapping ontologies and auditing foreign-key joins, super-hubs, or feature leakage, designing temporal splits and DGF GNN models, running multi-hop sampling on Dataflow or high-memory VMs, generating Colab Enterprise notebooks, or diagnosing GNN lift and Vizier tuning. Don't use for standalone Spanner Graph schema design, relational-to-graph migration, or GQL query tuning without ML (use spanner-graph-schema-best-practices, spanner-relational-to-graph, or spanner-graph-query-tuning), or non-graph tabular BigQuery ML (use bigquery-ai-ml).

FeaturedIncludes scriptsData & AnalyticsDevOps & Cloud
AI-generated overview

Guides end-to-end graph machine learning (GNN) solutions on Google Cloud, from domain fit and graph readiness audits to DGF pipelines and Colab training.

What it does
This skill walks an agent through a seven-step workflow for building graph machine learning solutions on Google Cloud. It covers business and domain alignment, data staging into BigQuery, Spanner or GCS, ontology and property graph mapping, a five-pillar graph readiness audit, GNN architecture and label design, Distributed Graph Flow pipeline synthesis, and training and tuning diagnostics. It produces artifacts such as domain alignment briefs, readiness scorecards, a pipeline handoff spec, and runnable Colab Enterprise notebooks, and it can recommend exiting to tabular ML when graph structure adds no value.
When to use it
Use it when deciding whether relational data benefits from GNN message passing versus tabular ML, staging enterprise sources into property graphs, auditing foreign-key joins, super-hubs or feature leakage, or designing and running DGF GNN training and tuning. It is not intended for standalone Spanner Graph schema design, relational-to-graph migration, GQL query tuning, or non-graph BigQuery ML.
Requirements
Requires the Google Cloud SDK (gcloud, bq), authentication via gcloud login or application default credentials, a project with billing and the relevant APIs enabled, and appropriate IAM roles. The dgf package (optionally dgf-nightly and apache-beam[gcp] for distributed Dataflow ETL) must be installed with user approval. Ships a BigQuery readiness audit SQL script and a Colab notebook builder script.

How AI overviews are written and checked

Graph machine learning (GNN) on Google Cloud

Usage Attribution

MUST READ: Before executing any gcloud, REST API, or MCP command, you MUST read and follow the instructions in Usage Attribution [blocked].


Google Cloud Prerequisites, IAM, Region & Cost Hygiene

Before provisioning resources or querying data, verify environment setup and obtain human authorization for billable actions:

1. Prerequisites Checklist

  • Google Cloud SDK (gcloud): Ensure gcloud and bq CLI tools are installed (Cloud SDK Installation). If missing locally, provide copy-ready commands for the user to run. Never install software packages on the host machine without explicit approval, because unsolicited host changes can conflict with local environments or security policies.

  • Distributed Graph Flow (dgf): GNN pipeline synthesis targets the open-source dgf engine (PyPI, Documentation). Never install packages without explicit user approval, as unrequested changes can break existing Python environments. Provide copy-ready commands for the user:

    • Default (stable release):

      pip install -U "dgf>=0.2.0,<0.3.0"
    • Alternative (instead of stable, pre-release nightly builds — both packages provide the top-level dgf/ module, so uninstall stable first):

      pip uninstall -y dgf && pip install -U dgf-nightly
    • Optional (only required for Tier 2 distributed Dataflow ETL via dgf.beam):

      pip install -U "apache-beam[gcp]>=2.78.0,<3.0.0"
  • Authentication:

    • Local CLI execution: gcloud auth login
    • Application Default Credentials (ADC): gcloud auth application-default login
    • Non-interactive / Service Account: set GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json.
  • Project Selection:

    gcloud config set project {project_id}
  • Active Billing Account: An active billing account must be attached to {project_id}. Note that while Google Cloud offers Free Tier allocations, an active billing instrument is mandatory for API enablement.

  • API Enablement:

    • Core APIs (BigQuery primary staging/audit backend, Cloud Storage artifacts, Colab Enterprise runtimes, and Compute Engine VMs):

      gcloud services enable \
        bigquery.googleapis.com \
        storage.googleapis.com \
        aiplatform.googleapis.com \
        dataform.googleapis.com \
        compute.googleapis.com
    • Optional Backend/Tier APIs (run only the command(s) for optional services used by your workflow):

      • Spanner / Spanner Graph (optional — only if reading from Spanner):

        gcloud services enable spanner.googleapis.com
      • Dataflow (optional — Tier 2 distributed ETL only):

        gcloud services enable dataflow.googleapis.com
      • Knowledge Catalog & Data Lineage (optional — only if using Dataplex):

        gcloud services enable dataplex.googleapis.com datalineage.googleapis.com

2. IAM Roles

Ensure the operator or service account holds the minimal roles applicable to the services used in the workflow:

  • BigQuery staging & audit (core — primary staging and audit backend; omit only if reading exclusively from Spanner or GCS): roles/bigquery.dataEditor, roles/bigquery.jobUser
  • Cloud Storage artifact staging (core — notebooks, checkpoints, and temporary graph exports): roles/storage.objectAdmin
  • Colab Enterprise & training (core — hosted notebooks and training jobs): roles/aiplatform.colabEnterpriseUser, roles/aiplatform.user
  • Spanner read access (optional — only if reading from Spanner / Spanner Graph): roles/spanner.databaseReader
  • Dataflow ETL scaling (optional — Tier 2 distributed ETL only): roles/dataflow.developer
  • Knowledge Catalog & Lineage (optional — if using Dataplex): roles/dataplex.catalogViewer, roles/datalineage.viewer

Always flag sensitive IAM privilege escalations or project policy edits for explicit human approval to enforce least-privilege access control.

3. Region Selection & Availability

  • Recommend a supported default region (e.g., us-central1):

    gcloud config set compute/region us-central1
  • Consult Google Cloud Locations for regional service availability. Certain preview capabilities (such as specific Vertex AI accelerator configurations or Spanner Graph features) may be restricted to select multi-regions or us-central1.

4. Cost Hygiene & Resource Cleanup

  • Review service pricing at Google Cloud Pricing. Never hardcode dollar figures because cloud pricing varies by region and changes over time; explain pricing drivers (BigQuery scan volume, Spanner compute nodes, Vertex AI GPU worker runtime).

  • Always execute --dry_run before running non-trivial BigQuery feature queries to report scanned bytes.

  • Prompt for human confirmation before launching Dataflow batch jobs, Vertex AI custom training jobs, or Vizier hyperparameter tuning studies, because distributed compute jobs incur significant billable costs.

  • Resource Teardown: Upon completing experimentation, clean up ephemeral resources to avoid accidental charges:

    # Delete staged Cloud Storage graph artifacts
    gcloud storage rm --recursive gs://{bucket_name}/graph_ml_artifacts/
    
    # Delete intermediate audit and feature tables
    bq rm -f -t {project_id}:{dataset}.dgf_feature_prep
    bq rm -f -t {project_id}:{dataset}.graph_readiness_audit
    
    # Delete Colab Enterprise runtimes
    gcloud colab runtimes delete {runtime_id} --region={region}
    
    # Cancel active Dataflow jobs
    gcloud dataflow jobs cancel {job_id} --region={region}
    
    # Cancel active Vertex AI hyperparameter tuning jobs
    gcloud ai hp-tuning-jobs cancel {job_id} --region={region}
    
    # Clean up project if running in a throwaway sandbox (MANDATORY human confirmation required)
    gcloud projects delete {project_id}

State 0, Persona Calibration & Two-Layer Gating ("Beginner-Safe, Pro-Fast")

State 0 Greeting Protocol

When the user sends a greeting ("Hi", "Hello", "Help me with graph ML", or "What can you do?") without attaching concrete schemas, tables, or task definitions:

  1. Warmly introduce your role as the Google Cloud Graph Machine Learning co-pilot.
  2. Concisely outline end-to-end Graph ML capabilities on Google Cloud, explicitly explaining support across BigQuery Property Graphs, Spanner Graph, and Distributed Graph Flow (DGF):
    • Domain Alignment & Fit Evaluation: Determining whether relational data benefits from GNN message passing versus tabular ML.
    • Multi-Source Context & Knowledge Catalog Grounding: Grounding business concepts in Google Cloud Knowledge Catalog (Dataplex) or 3rd-party catalogs (Collibra, Atlan, Alation, DataHub, Unity Catalog), and staging SaaS/docs into BigQuery/Spanner/GCS.
    • 5-Pillar Graph Readiness Auditing: Detecting super-hubs, degree skew, target connectivity gaps, and point-in-time leakage before training.
    • End-to-End DGF Pipeline Synthesis: Generating runnable Vertex AI Colab Enterprise notebooks targeting Distributed Graph Flow (dgf).
  3. Offer 3 actionable next steps and pause for their response without grilling:
    • Option 1: Explore Concepts & "Do I Need Graph ML?" (novice-friendly walk-through).
    • Option 2: Guided Business & Domain Discovery (define actors, causality, and KPI).
    • Option 3: Fast-Path Schema & Data Audit (jump straight to evaluating existing tables).

Precedence Rule

If the user's initial prompt combines a greeting with a concrete technical task (e.g., "Hi, audit my BigQuery fraud dataset project.dataset.transactions for GNNs"):

  • Immediately bypass the State 0 pause and activate the relevant step.
  • State inferred Step 1 Domain Assumptions (target entity, predicted outcome).
  • Continue enforcing all downstream Hard Invariant Gates!

Persona Calibration & Two-Layer Gating

Calibrate the depth and tone of interactions dynamically:

  • Beginner Mode:
    • Detected when the user expresses unfamiliarity with GNN concepts or asks exploratory questions.
    • Use plain business terminology and real-world analogies (e.g., flight hub networks, customer referral webs).
    • Limit discovery questions to 1–2 per turn.
    • Provide recommended defaults with clear explanations ("Why").
  • Pro Mode:
    • Detected when the user provides specific table schemas, DDL, or GNN targets.
    • Present compact markdown verification tables.
    • Collapse Assisted Decision Gates when inputs are unambiguous.
    • Pause only on Hard Invariant Gates (zero join resolution, extreme degree skew, future data leakage) or billable cloud execution.

Knowledge Catalog Grounding Check

Before guessing domain terms or table roles:

  1. Silent MCP Inspection: Silently check if any Knowledge Catalog MCP server is mounted (knowledge-catalog, dataplex, datahub, atlan, collibra, alation).
  2. User KC Confirmation: Unless the user selected Posture A (Zero-Dataset Novice starter), confirm catalog usage in both cases:
    • If catalog MCP detected: Mention the detected server (e.g., dataplex) and confirm whether to ground against it and any other Google Cloud or 3P catalog integrations.
    • If no catalog MCP detected: Ask whether they have integrations with Google Cloud Knowledge Catalog (Dataplex) or a 3rd-party KC (Collibra, Atlan, Alation, DataHub, Unity Catalog) for business glossaries, lineage, and PII tags, or should inspect raw schemas directly.

7-Step Cyclic Workflow & Progressive Reference Loading

flowchart TD
    S1["Step 1: Business & Domain Alignment"] -->|"Relational Signal Confirmed"| S2["Step 2: Data Exploration & Staging"]
    S1 -->|"Tabular Independent Signal"| S1_Exit["Honest Exit: BigQuery ML / Vertex Tabular"]

    S2 --> S3["Step 3: Ontology & Property Graph Mapping"]
    S3 -->|"<50% Join Match / Missing Bridge"| S2

    S3 --> S4["Step 4: 5-Pillar Graph Readiness Audit"]
    S4 -->|"Missing Bridge / Unstitchable FK"| S2
    S4 -->|"Schema Entity Mismatch"| S3

    S4 -->|"Readiness Scorecard Passed"| S5["Step 5: GNN Architecture & Label Exploration"]
    S5 -->|"Feature Re-Engineering"| S4
    S5 -->|"Structural Edge Refinement"| S3
    S5 -->|"New Context Table Required"| S2

    S5 --> S6["Step 6: DGF Pipeline Synthesis & Colab Hosting"]
    S6 -.->|"Generates"| SPEC["pipeline_handoff_spec.yaml"]
    S6 -->|"Extreme Hub / OOM During Sampling"| S4

    S6 --> S7["Step 7: Training, Tuning & Loop-Back Diagnostics"]
    S7 -->|"Underfitting / No Topology Gain"| S5
    S7 -->|"Neighborhood Explosion"| S4
    S7 -->|"Graph Connectivity Sparsity"| S3
    S7 -->|"Data Staleness / Label Leakage"| S2

Progressive Reference Loading Instruction

CRITICAL: To maintain context efficiency, open ONLY the reference file associated with your currently active step. Do not pre-load downstream step references until their upstream gates are satisfied.

StepTopicReference File & ArtifactsPrimary Gate / Output
Step 1Business & Domain Alignment01_business_and_domain_alignment.md [blocked]<br>assets/domain_alignment_brief_template.mdGate 1: Domain Alignment Brief & Graph Fit Verdict
Step 2Data Exploration & Staging02_data_exploration.md [blocked]Gate 2: Google Cloud Staged Entity & Relation Table Inventory
Step 3Ontology & Graph Mapping03_ontology_mapping.md [blocked]Gate 3: Verified Graph Schema (FK Match Rate >= 95%)
Step 45-Pillar Graph Readiness Audit04_graph_readiness.md [blocked]<br>assets/graph_readiness_scorecard_template.md<br>scripts/bigquery_graph_readiness_audit.sqlGate 4: Graph Readiness Scorecard, Feature Prep DDL & Loop-Back Triggers
Step 5GNN Architecture & Labels05_gnn_architecture_and_labels.md [blocked]Gate 5: GNN Model Architecture & Split Specification
Step 6DGF Synthesis & Colab Hosting06_pipeline_synthesis_and_colab.md [blocked]<br>assets/pipeline_handoff_spec.yaml<br>scripts/build_colab_notebook.pyGate 6: Executable DGF Vertex AI Colab Notebook
Step 7Training & Diagnostics07_training_and_tuning_runs.md [blocked]Gate 7: Converged Training Run & Evaluation Receipts (Vizier HPT Gated)

Step Summaries, Gates & Upstream Loop-Backs

  • Step 1: Business & Domain Alignment: Define unit of operational action, real-world actor interaction hypotheses, label maturity horizon, and error asymmetries. Ground domain terms against Knowledge Catalog Business Glossaries, Context Sets, and certified KPIs within the strict No-SQL/No-DDL gate. Conduct an honest "Do You Need Graph ML?" evaluation. If rows are independent and tabular features dominate, recommend BigQuery ML or Vertex AI Tabular and exit cleanly.
  • Step 2: Data Exploration & Staging: Execute "Catalog-First, Scan-Second" discovery across Google Cloud Knowledge Catalog (Dataplex) or 3rd-party catalogs (Collibra, Atlan, Alation, DataHub, Unity Catalog) via live MCP/API, Google Cloud federation, or offline metadata exports (dbt/OSI). Identify certified System-of-Record tables and lineage edges before falling back to raw INFORMATION_SCHEMA scans. Stage tables into canonical Google Cloud storage (BigQuery, Spanner, GCS).
  • Step 3: Ontology & Property Graph Mapping: Translate domain entities and events into nodes and edges, seeding candidate links from Knowledge Catalog Semantic Models (OSI+G), ER schemas, or dbt relationship tests. Enforce "Catalog Hints ≠ Physical Graph Truth": catalog relationships are candidate seeds that MUST still pass empirical SQL foreign-key join verification (≥ 95% pass rate, < 50% loop-back block), because documented schemas frequently diverge from physical production keys. Note that SimpleSamplingConfig defaults to reverse=True (bidirectional message passing), making redundant reverse SQL edge aliases unnecessary.
  • Step 4: 5-Pillar Graph Readiness Audit: Harvest Knowledge Catalog DataScans / precomputed profiling stats, data lineage for temporal leakage, and Aspect / BigQuery Policy / 3P PII sensitivity tags. Score sentinel super-hubs, target connectivity, feature hygiene, and point-in-time leakage. Because auto_normalize strips edge features, project critical relational attributes onto endpoint node tables in SQL. Deterministically trigger loop-backs to Step 3 or Step 2 if readiness gates fail.
  • Step 5: GNN Architecture & Label Exploration: Select prediction task (node, link, or graph classification/regression), evaluate model backbones (hmpnn, mtalbis, hgat) with volume-aware message_aggregation ("sum", "mean"), and design point-in-time train/val/test splits.
  • Step 6: DGF Pipeline Synthesis & Colab Hosting: Generate modular pipeline_handoff_spec.yaml and synthesize runnable code using Distributed Graph Flow (dgf). Enforce the 1-arg infer_schema_semantic(schema) signature, execute validate_graph(graph, schema) before #id filtering, and render metrics and perturbation analysis via IPython.display.display. Scale Tier Routing is user-configurable and VM-capacity-aware:
    • Explicit User Override & High-RAM Single-VM (routing_mode: "USER_OVERRIDE"): Explicit user scale_tier or VM capacity overrides (machine_type, target_vm_ram_gb, max_in_memory_edges, max_in_memory_features_gb in pipeline_handoff_spec.yaml) always take precedence. Provisioning a high-RAM Colab Enterprise runtime template or Compute Engine VM (e.g., m3-ultramem-64 with 1,952 GB (~1.95 TB) RAM, m3-ultramem-128 with 3,904 GB RAM, or n2-highmem-128) allows Tier 1 (dgf.learning single-VM in-memory) to scale up to 1B+ edges without Dataflow overhead.
    • Tier 1 (Single-VM In-Memory / Colab Enterprise): In-memory dgf.learning Vertex AI Colab Enterprise notebook. When no custom VM capacity is specified (routing_mode: "AUTO"), defaults conservatively to < 10M edges and < 4 GB features for standard 16–32 GB notebook runtimes.
    • Tier 2 (Distributed Dataflow / Beam): When dataset scale exceeds single-VM memory limits without a large-VM override (or when TIER_2 is explicitly requested), route to distributed Apache Beam on Google Cloud Dataflow using dgf.beam (dgf.beam.program_started, dgf.beam.analyse.feature_statistics, dgf.transform.auto_normalize, dgf.beam.sampling.semi_distributed_sampler_v2, dgf.beam.io.write_tfgnn_graphs).
    • Tier 3 (Custom Flax Backbone): Specialized research architectures requiring explicit Flax neural backbones using dgf.jax.layers. Always consult 06_pipeline_synthesis_and_colab.md [blocked] for full pipeline templates.
  • Step 7: Training, Tuning & Loop-Back Diagnostics: Execute training, profile loss curves in nats (cross-entropy), evaluate PR-AUC and Precision@K for true triage lift, and note that early_stopping=True restores optimal checkpoint weights while stdout echoes the final step dict. Strictly block automated hyperparameter tuning (e.g., Vertex AI Vizier) if the GNN does not beat the 0-hop tabular baseline, because tuning cannot fix underlying structural or data defects; follow deterministic loop-backs to Step 4 (sentinel hub filtering) or Step 3 (noisy edge ontology review). Explicitly remind the user that even after lift is confirmed, launching Vizier sweeps requires human approval for trial budget and machine costs.

Source and attribution

Source:google/skillsinskills/cloud/google-cloud-solution-graph-mlat commit751b947

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Add a badge to your README

Show readers this skill is listed on SourceWeft. The badge links to this page.

Preview of the “Listed on SourceWeft” badge
[![Listed on SourceWeft](https://sourceweft.com/badge/skills/gh-google-skills-google-cloud-solution-graph-ml-skills-cloud-google-cloud-solution-graph-ml-c06b166a4da15fa6.svg)](https://sourceweft.com/skills/gh-google-skills-google-cloud-solution-graph-ml-skills-cloud-google-cloud-solution-graph-ml-c06b166a4da15fa6?utm_source=readme&utm_medium=badge)

Report or request removal