Logo vun Graph Model Selector

Graph Model Selector

Communautéit
AnthonyAlcaraz
graph-model-selector

Select a graph data model — labeled property graph (LPG) vs RDF vs hypergraph — by scoring REASONING REQUIREMENTS against five implementation features (formal reasoning, n-ary relations, performance, tool ecosystem, constraint expressiveness), per Ch3 "Evaluating Graph Models". Also models the n-ary -> hyperedge representation (Example 3-1: a prescription connecting doctor + patient + medication + dosage + date + condition as ONE hyperedge vs the 1-intermediate-node + N-edge reification an LPG/RDF forces). The chapter's rule: start from "what reasoning must my agents do?", not from the data. Use when choosing a graph backend for an agentic system, justifying a build-vs-buy or model choice, or deciding whether an n-ary fact needs a hyperedge. NOT for picking a specific vendor product (this picks the model class, not Neo4j-vs-Neptune), NOT for non-graph storage decisions, NOT when the org already mandates a model (just adopt it).

Iwwersiicht

EditeurAnthonyAlcaraz
Repositoryagentic-graph-rag-skills
Skill-Nummgraph-model-selector
Stären
29
Forks
9
Matgeliwwert Fichieren
2
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 2 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    Vum AnthonyAlcaraz op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Graph Model Selector an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills/tree/main/skills/knowledge-representation/graph-model-selector
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills.git /tmp/agentic-graph-rag-skills
mkdir -p .claude/skills
cp -r /tmp/agentic-graph-rag-skills/skills/knowledge-representation/graph-model-selector .claude/skills/graph-model-selector
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Graph Model Selector an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Graph Model Selector automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Graph Model Selector net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Graph Model Selector

Overview

AI agents are only as intelligent as the knowledge structures you give them, and the model you choose constrains what they can reason about. The chapter is explicit: start with your reasoning requirements, not your data. Formal logical inference (medical diagnosis) demands a different model than traversal-heavy network analysis or many-entity events.

Three model classes, each with a characteristic profile:

  • Labeled property graph (LPG): fast traversals, mature ecosystem (Neo4j / Neptune / ArangoDB), flexible. Can only tell you what you explicitly programmed — no native inference.
  • RDF (subject-predicate-object triples): formal logical semantics enable native inference. Tell it Disease1 causes Symptom1 and Patient exhibits Symptom1 and it infers Disease1 is a candidate diagnosis with no rule written. Slower; n-ary needs reification.
  • Hypergraph: one hyperedge connects any number of entities, so n-ary relations are native — no auxiliary nodes. Ecosystem is immature.

The selector scores each model across the five features the chapter names (formal reasoning, n-ary, performance, tool ecosystem, constraint expressiveness) weighted by the caller's requirements, and surfaces a hybrid recommendation when the top two are close (the chapter's "Putting it all together" hybrid guidance).

The n-ary helper makes the trade-off concrete. A prescription (doctor + patient + medication + dosage + date + condition) is one hyperedge (representation_cost.hypergraph_elements == 1) but costs 1 + arity elements (one relation node + one edge per participant) under LPG or RDF reification.

When to Use

  • Choosing a graph backend model class for a new agentic system
  • Justifying a build-vs-buy or LPG-vs-RDF-vs-hypergraph decision in a design doc
  • Deciding whether a multi-entity fact warrants a hyperedge or reification

Phrases: "which graph model", "property graph vs RDF", "hypergraph", "n-ary relation", "reification", "graph data model selection", "Neo4j vs RDF".

When NOT to Use

  • Picking a specific product. This selects the model class, not Neo4j-vs-TigerGraph-vs-Neptune. Vendor choice is downstream (see Ch3 build-vs-buy six-factor list).
  • Non-graph storage. If the data is genuinely tabular with no relationship reasoning, a relational store is correct.
  • An org-mandated model. If finance mandates RDF/OWL or the platform is fixed, adopt it; the scoring is moot.
  • A single binary relationship. Arity-2 facts don't need the n-ary helper; a plain labeled edge is fine.

Process

StepInputActionOutputVerification
1Reasoning requirements (5 weights 0..3)lib.score_models(reqs)[(model, score), ...] sorted descweights * feature-scores, descending order
2Samelib.recommend_model(reqs){recommended, scores, rationale, hybrid_recommended}RDF wins on formal, hypergraph on n-ary, LPG on perf+tooling
3An n-ary fact as a HyperEdge(type, nodes, attributes)lib.representation_cost(edge){arity, hypergraph_elements=1, property_graph_elements=1+N, rdf_reified_triples=1+N}hypergraph cost is 1; others are 1+arity
4Same hyperedgelib.reify_as_property_graph(edge)1 intermediate node + N edges listingintermediate_nodes==1, auxiliary_edges==arity

Rationalizations

Agent rationalizationDocumented rebuttal
"Property graphs are popular, just use Neo4j for everything."Popularity is the tool-ecosystem axis only. If the agent needs native inference (medical diagnosis, compliance), LPG forces you to hand-code every inference rule. The chapter's whole point: the model constrains reasoning — pick from requirements, not from market share.
"RDF does reasoning, so always pick RDF."RDF pays in performance and n-ary complexity (reification). Traversal-heavy real-time analytics on RDF can be the wrong call. The five-feature scoring exists precisely so one axis doesn't dominate by default.
"I'll force this 6-entity prescription into binary edges — hyperedges are exotic."representation_cost shows the bill: 1 relation node + 6 edges, and queries must traverse all of them to reconstruct the event. The hyperedge keeps semantic unity in one element. The chapter calls binary-forcing "artificial complexity."
"The selector said hybrid — that's a cop-out."The chapter explicitly recommends hybrids ("a property graph for high-performance traversals combined with an RDF/OWL layer for formal reasoning"). When two axes both matter and no single model covers both, the hybrid IS the answer — record it as a conscious trade-off, not a non-decision.
"Skip the model question, use PostgreSQL triples (Example 3-2)."Valid for retrieval-focused systems with predictable query patterns — the chapter says so. But for temporal reasoning, contradiction management, and incremental processing, dedicated graph models win. Score the requirements first; the PG-triples fallback is a deliberate choice, not a default.

Red Flags

  • All five requirement weights set to 3. You have not actually prioritized — re-interview the use case. If everything is critical, nothing is, and the selector degenerates to the raw feature averages.
  • Recommended = RDF but performance weight is the highest. Mismatch: re-check the weights. RDF's performance score is the lowest of the three.
  • Hybrid flagged but the team has no appetite for two systems. Record the trade-off explicitly: pick the single model that covers the higher-weighted axis and accept the documented gap on the other.
  • Choosing hypergraph for a team with no hypergraph DB experience. The ecosystem is immature; budget for custom tooling or reconsider.

Non-Negotiable Verification

  1. Run the benchmark battery. python cli.py benchmark must report 10/10:
    • RDF wins formal-only, hypergraph wins n-ary-only, LPG wins perf+tooling
    • n-ary cost: hypergraph = 1 element, LPG/RDF = 1 + arity
    • reification produces exactly 1 intermediate node + arity edges
    • hybrid surfaces on balanced formal+n-ary requirements
  2. Run the scenario. python cli.py scenario medical-diagnosis recommends an inference-capable model and prints the n-ary prescription cost.
  3. Verify CLI help. python cli.py --help exits 0 and prints this SKILL.md description (so any harness can discover the skill from --help).

Security Posture

  • Prompt injection. Inputs are requirement weights and hyperedge specs - pure data scored against fixed feature tables. Adversarial values (inflated weights, crafted attribute strings) can at most skew a recommendation; nothing in the input is executed or interpolated into a query.
  • Data exfiltration. No network calls, no file writes. Hyperedge attributes may describe sensitive domain facts (the prescription example); they stay in-process and appear only in the stdout cost report the caller owns.
  • Privilege escalation. No shell invocation, no eval, no dynamic import. The recommendation is advisory - it selects a model class on paper; provisioning an actual graph backend happens elsewhere under the platform's own controls.

Source Attribution

Distilled from Agentic GraphRAG (O'Reilly, by Anthony Alcaraz and Sam Julien) Ch3 — Knowledge Representation, sections "Graph Data Models", "Evaluating Graph Models" (the five implementation features), and the n-ary discussion with Example 3-1 (hypergraph prescription). The four-stage graph-RAG framing is Zhou et al., "In-depth Analysis of Graph-based RAG in a Unified Framework", cited in the same chapter. PostgreSQL-triples fallback: Example 3-2.

Matgeliwwert Fichieren

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Graph Model Selector?

Select a graph data model — labeled property graph (LPG) vs RDF vs hypergraph — by scoring REASONING REQUIREMENTS against five implementation features (formal reasoning, n-ary relations, performance, tool ecosystem, constraint expressiveness), per Ch3 "Evaluating Graph Models". Also models the n-ary -> hyperedge representation (Example 3-1: a prescription connecting doctor + patient + medication + dosage + date + condition as ONE hyperedge vs the 1-intermediate-node + N-edge reification an LPG/RDF forces). The chapter's rule: start from "what reasoning must my agents do?", not from the data...

Firwat Graph Model Selector op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Graph Model Selector besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Graph Model Selector an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills/tree/main/skills/knowledge-representation/graph-model-selector an. TypingMind liest d'Datei SKILL.md, bündelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Graph Model Selector benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Graph Model Selector benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Graph Model Selector domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Graph Model Selector gratis?

Jo. De Skill gëtt vum AnthonyAlcaraz ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇