Skip to content

Add NetworkX graph visualization example to README #4

@chigwell

Description

@chigwell

User Story
As a developer using the eknowledge package,
I want a visual example of graph generation in the README
so that I can quickly understand how to visualize extracted relationships.

Background
The current README's code example only shows text-based graph output ([{'from': 'quick brown fox', 'relationship': 'interacts_with', 'to': 'lazy dog'}]), which fails to demonstrate practical visualization. This creates friction for users who need to validate graph structures visually. The execute_graph_generation function in main.py already returns graph data - we should extend the example to show NetworkX-based visualization.

Acceptance Criteria

  • Modify README.md to include a graph visualization example after the existing text output
  • Add NetworkX/Matplotlib code to:
    1. Convert the extracted relationships into a NetworkX DiGraph
    2. Generate a matplotlib figure with node labels and layout
    3. Save visualization as example_graph.png
  • Ensure the example:
    • Includes import networkx as nx and import matplotlib.pyplot as plt
    • Uses distinct colors for nodes/edges
    • Shows both text output AND displayed/saved visualization
  • Verify the visualization renders correctly when users copy-paste the example
  • Update installation instructions to include pip install networkx matplotlib

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions