Identify and analyze cause-effect chains within knowledge graphs to perform root cause analysis and trace impact propagation.
This skill enables comprehensive causal analysis by traversing directed graphs following causal relationships to discover root causes, trace downstream effects, detect cycles, and rank causality chains by strength or proximity.
This skill operates on relationships representing causal or dependency links, including:
causes - Direct causal relationship (A causes B)leads_to - Event progression (A leads to B)results_in - Direct outcome (A results in B)triggers - Activation relationship (A triggers B)depends_on - Dependency relationship (A depends on B)influences - Indirect causation (A influences B)contributes_to - Contributory cause (A contributes to B)propagates_to - Effect propagation (A propagates to B)Relationships may include optional properties for ranking:
weight - Strength of causality (0.0 to 1.0)confidence - Certainty of relationship (0.0 to 1.0)latency - Time delay between cause and effectseverity - Impact severity of the relationshipThe initial triggering event or condition that starts a causal chain. Identified as nodes with no incoming causal edges.
text
Power_Surge (root cause) → Server_Shutdown → API_Failure → User_Impact
A directed path through the graph where each node triggers the next, representing the complete cause-effect sequence.
text
Chain: [A → B → C → D]
Depth: 4 nodes
Distance: 3 relationships
How consequences spread through interconnected systems, potentially causing cascading failures or distributed impacts.
text
Single Cause: A
Propagates to: B, C, D (different effect paths)
Total Impact: 4 affected nodes
Events that result from multiple independent or dependent causes (AND/OR relationships).
text
A ─┐
├→ D (A AND B cause D)
B ─┘
A → C ─┐
├→ E (C OR D cause E)
B → D ─┘
Identifying circular dependencies where causality loops back on itself (A→B→...→A).
text
Cycle: A → B → C → A
Risk: Infinite propagation without cycle breaking
text
Graph: A→B→C
A→D→E
DFS Order: A, B, C, D, E (depth-first)
text
Graph: A→B→C
A→D→E
BFS Order: A, B, D, C, E (level-by-level)
Prioritize causes by distance (closer causes ranked higher).
text
A --(1)-- B --(1)-- C --(1)-- Target
Ranking: A(distance=3), B(distance=2), C(distance=1)
Score chains by cumulative confidence of relationships.
text
Chain: A --(0.9)-- B --(0.7)-- C
Score: 0.9 * 0.7 = 0.63 (confidence product)
Prioritize by relationship weights or edge properties.
text
Edges: [weight, confidence]
A --(0.8, 0.9)-- B --(0.6, 0.7)-- C
Combined score: (0.8 * 0.9) * (0.6 * 0.7) = 0.3024
Bayesian approach incorporating base rates and conditional probabilities.
text
P(Effect|Cause) * P(Cause) / P(Effect)
Scores reflect likelihood of causal relationship
Identifies strongly connected components (cycles) in directed graphs.
Tracks visited nodes during traversal; back edge indicates cycle.
Minimum set of edges to remove to make graph acyclic.
text
Target: User_Login_Error
Backward traversal: User_Login_Error ← API_Failure ← Server_Down ← Power_Surge
Root causes: [Power_Surge]
text
Source: Database_Corrupted
Forward traversal: Database_Corrupted → Query_Failures → Service_Degradation
Effects: [Query_Failures, Service_Degradation]
Affected: 2 downstream nodes
text
Chain Metrics:
- Max depth: 5 hops
- Nodes involved: 12
- Branching factor: 2.4 avg
- Coverage: 85% of graph
text
Threshold: 0.6
Chain A: 0.9 * 0.8 * 0.7 = 0.504 (FILTERED OUT - below threshold)
Chain B: 0.95 * 0.9 = 0.855 (INCLUDED)
IssueCauseSolutionInfinite loopsCyclic graph detectedEnable cycle detection, apply cycle breakingDepth explosionVery deep chainsSet max_depth limit, use BFS insteadMemory overflowToo many branchesLimit branching factor, paginate resultsNo root causes foundTarget is isolatedCheck graph connectivity, verify relationship typesConflicting causesCircular dependenciesRun Tarjan's algorithm, resolve feedback loopsLow confidenceWeak causal linksIncrease confidence threshold, inspect edge weightsMissing relationshipsIncomplete graphVerify data ingestion, check relationship creationTimeoutComplex graphOptimize traversal, cache intermediate results
✓ Define causal relationships clearly - Use consistent relationship types and semantics
✓ Add confidence scores - Weight relationships by certainty for better ranking
✓ Enable cycle detection - Prevent infinite loops in complex graphs
✓ Set reasonable depth limits - Avoid memory issues with very deep chains
✓ Use appropriate algorithms - DFS for deep chains, BFS for propagation analysis
✓ Rank results meaningfully - Apply proximity or confidence-based scoring
✓ Validate root causes - Verify causes have no incoming causal edges
✓ Document assumptions - Clarify causal semantics for your domain
✓ Cache traversals - Store frequently used paths for performance
✓ Monitor performance - Track analysis time and result quality
✓ Handle partial results - Return best-effort answers for timeout scenarios
✓ Version relationship types - Allow evolution of causal definitions
Handle events caused by multiple independent or dependent causes, including AND/OR logic for cause combinations.
Consider time ordering when relationships include temporal properties (latency, timestamp).
Apply decay functions to reduce confidence in distant causes (causality weakens over distance).
Define domain-specific scoring for combining multiple ranking criteria.
Analyze multiple targets or sources simultaneously for comparative impact assessment.
Compare different causal paths to the same effect to identify alternative explanations.
This skill integrates with:
networkx - Graph construction, traversal algorithmsigraph - Fast graph algorithms and cycle detectiongraphlib - Topological sorting and DAG operationspygraphviz - Graph visualizationdataclasses - Python classes for configurationtyping - Type hints for claritycollections - Deque for BFS traversalitertools - Combinatorial path generationheapq - Priority queues for weighted traversalfunctools - Memoization for path cachingmatplotlib - Graph plottingplotly - Interactive visualizationpyvis - Interactive network visualizationpytest - Test frameworkhypothesis - Property-based testingVersion: 1.0.0