KG Emergence
Algorithm Design

How candidate structural motifs are found without knowing the question in advance: edge-dominance scoring, ego-neighborhood extraction, canonicalization into role families, recurrence scoring, and latent missing-edge prediction.


title: "Graphlet Generator Design" created: "2026-06-20" artifact_type: "algorithm_design" status: "draft v0.1" purpose: "Specify generators for candidate graphlets using near-edge dominant concepts, canonical roles, culture partitions, and out-of-sample validation."


Graphlet Generator Design

0. Premise

The user does not yet know the right questions. Therefore the system should generate candidate questions and graphlets from structure.

The generator should begin with:

near-edge dominant concepts
culture/tradition partitions
canonical role projections
local ego-neighborhoods
recurring typed structures
latent missing-edge predictions

The goal is not to output "the answer." The goal is to output:

candidate graphlets
structure-watch hypotheses
latent structures
next-best questions

1. Inputs

Nodes:
  Actor
  Event
  Source
  Observation
  Claim
  LocalConcept
  CanonicalRole
  Mechanism
  Practice
  Symbol
  LatentStructure

Edges:
  typed relations with confidence, salience, bridge_quality, source_family_id

Metadata:
  tradition
  culture
  language
  date_range
  source_family_id
  split
  ontology_layer
  holdout_status

2. Output Objects

GraphletCandidate:
  graphlet_id: string
  canonical_node_roles: list
  canonical_edge_roles: list
  supporting_instances: list
  cultures_present: list
  source_families_present: list
  recurrence_score: float
  independence_score: float
  mapping_confidence: float
  anomaly_pressure: float
  prediction_potential: float
  anti_overfit_penalty: float
  candidate_score: float
  latent_predictions: list
  next_best_questions: list

3. Step 1: Compute Near-Edge Dominant Concepts

For every concept node c:

edge_dominance(c) =
    Σ_e incident(c) [
      edge_salience(e)
    * edge_confidence(e)
    * bridge_quality_weight(e)
    * source_independence(e)
    * recurrence_hint(e)
    ]
    / degree_penalty(c)

Degree penalty:

degree_penalty(c) = log(2 + degree(c)) ^ alpha

Use alpha around 0.5 to 1.5.

Rationale:

Generic concepts like "evil" should not dominate just because they connect everywhere.
Specific but structurally powerful concepts like "whisper", "inversion", "confession", "blackmail", "purification" should surface.

4. Step 2: Role Projection

Each local concept maps to a vector of canonical roles.

Example:

waswasa:
  whispering_influence: 0.95
  deception: 0.70
  possession_influence: 0.30
  moral_inversion: 0.40
  awareness_remedy: 0.75

The graphlet generator should use role vectors, not only labels.

Similarity:

role_similarity(a, b) = cosine(role_vector(a), role_vector(b))

But relation topology matters more than vector similarity.


5. Step 3: Ego-Neighborhood Extraction

For high-dominance concepts:

extract radius-1 and radius-2 ego graphs
filter by:
  edge_confidence >= loose_threshold
  edge_salience >= salience_threshold
  ontology_layer compatibility
  source_family de-duplication

Do not overfilter in exploration.

Recommended:

exploratory_thresholds:
  edge_confidence >= 0.15
  edge_salience >= 0.50

fact_thresholds:
  edge_confidence >= 0.70
  export_to_fact_layer = true

6. Step 4: Canonicalization

Convert the local ego graph into a canonical graphlet.

LocalConcept -> top-k CanonicalRole labels
Person -> ActorRole
Institution -> InstitutionRole
Event -> EventRole
Practice -> RemedyRole
Symbol -> SymbolRole
Claim -> ClaimRole

Edge canonicalization:

ASSERTS / ALLEGES / DOCUMENTS -> EvidenceRelation
INFLUENCES / TEMPTS / WHISPERS -> InfluenceRelation
CORRUPTS / INVERTS -> MoralInversionRelation
ISOLATES / RECRUITS / INDUCES -> CoerciveConversionRelation
PURIFIES / REMEDIATES -> RemedyRelation

Canonical graphlet key:

hash(sorted node_role multiset + sorted typed edge triples + directionality signature)

Keep directionality. Direction is often the signal.


7. Step 5: Recurrence Across Partitions

For each canonical graphlet:

recurrence_count = number of independent subgraphs containing graphlet
culture_diversity = number of culture buckets
tradition_diversity = number of traditions
temporal_diversity = spread across time buckets
source_family_diversity = number of independent source families

Source-family leakage penalty:

source_independence =
  independent_source_families / raw_source_count

8. Step 6: Latent Prediction Generation

A graphlet becomes more valuable if it predicts missing structure.

For every graphlet template:

learn common role sequence
identify missing role in a partial instance
create LatentStructure
rank by structural cavity score

Example:

Known graphlet:
  recruiter -> isolation -> confession -> transgression -> blackmail -> deployment

Observed partial:
  recruiter -> isolation -> confession -> transgression -> deployment

Predicted missing:
  blackmail_or_shame_lock edge/node

Latent prediction object:

latent_type: LatentEdge
source_node: transgression
target_class: blackmail_or_shame_lock
predicted_by: manufactured_criminality_graphlet
specificity: medium
status: unresolved

9. Step 7: Next-Best-Question Generation

For each latent structure:

question = "What evidence would most reduce uncertainty about this missing edge?"

Rank:

priority =
    expected_information_gain
  * salience
  * feasibility
  * source_availability
  * safety_factor

Question templates:

Does source family X contain evidence of relation Y?
Does culture A have a local concept mapping to role R?
Does this graphlet survive source-family de-duplication?
Does this mechanism recur in out-of-sample tradition T?
Does rival explanation E explain the same partial graphlet?
What missing document type would distinguish H1 from H0?

10. Generator Modes

10.1 Exploratory mode

Purpose:

Find candidate structures.

Properties:

loose confidence thresholds
high salience sensitivity
allows symbolic layers
outputs many candidates
marks as exploratory

10.2 Validation mode

Purpose:

Test frozen graphlets.

Properties:

no graphlet mutation
strict source-family de-duplication
fixed role mappings
records misses

10.3 Holdout mode

Purpose:

Score out-of-sample predictive performance.

Properties:

no tuning
no new canonical roles unless marked post-hoc
failed predictions logged
null model comparison required

11. Sorting Views

The generator should output sorted tables.

11.1 By edge dominance

concept
tradition
culture
edge_dominance
top_edges
top_mechanisms

11.2 By graphlet recurrence

graphlet
recurrence_count
culture_diversity
source_family_diversity
candidate_score

11.3 By latent prediction

latent_structure
predicted_by
latent_confidence
latent_salience
expected_information_gain
next_question

11.4 By culture/concept matrix

Rows:

tradition / culture

Columns:

canonical roles or graphlets

Cells:

mapping_weight or graphlet_instance_score

This is the view where the user can visually see convergence and non-convergence.


12. Pseudocode

def generate_graphlets(graph, split="train", mode="exploratory"):
    nodes = filter_nodes_by_split(graph.nodes, split)
    edges = filter_edges_by_split(graph.edges, split)

    concept_scores = compute_edge_dominance(nodes, edges)
    seeds = select_top_concepts(concept_scores, mode=mode)

    candidates = []
    for seed in seeds:
        ego = extract_ego_graph(graph, seed, radius=2, mode=mode)
        canonical = canonicalize_graphlet(ego)
        candidates.append(canonical)

    grouped = group_isomorphic_or_similar_graphlets(candidates)
    scored = score_graphlet_candidates(grouped)
    latent = generate_latent_predictions(scored, graph)
    questions = generate_next_best_questions(latent, graph)

    return {
        "concept_scores": concept_scores,
        "graphlet_candidates": scored,
        "latent_predictions": latent,
        "next_best_questions": questions,
    }

13. What This Prevents

This design prevents:

- starting with only the user's preferred graphlet
- flattening cultures into one mythology
- validating on the same cases used to discover the structure
- letting generic concepts dominate
- mistaking symbolic similarity for causal connection
- ignoring missing edges
- failing to record failed predictions

It enables:

- exploratory discovery
- out-of-sample testing
- hidden-structure prediction
- next-best-question generation
- convergence detection across meaning systems
Generated by scripts/build_site.py from docs/*.md. Single source of truth: the Markdown. Do not hand-edit this HTML.