Feature Status: Implemented
Version: 1.1.0
Requirements: plotly (optional, for charts)
The Graph Analytics AI Platform now generates beautiful, interactive HTML reports with embedded Plotly charts. Reports include:
- Interactive visualizations (hover, zoom, pan)
- AI-generated insights with confidence scores
- Actionable recommendations prioritized by impact
- Algorithm-specific charts tailored to each analysis type
- Professional design ready for stakeholder presentations
pip install graph-analytics-aipip install graph-analytics-ai plotlyfrom graph_analytics_ai.ai.reporting import ReportGenerator, HTMLReportFormatter
# Initialize with chart generation enabled
generator = ReportGenerator(enable_charts=True)
# Generate report from execution results
report = generator.generate_report(execution_result, context={
"use_case": {"title": "Household Identity Resolution"},
"requirements": {"domain": "advertising technology"}
})
# Format as interactive HTML
html_formatter = HTMLReportFormatter()
charts = report.metadata.get('charts', {})
html_content = html_formatter.format_report(report, charts=charts)
# Save to file
with open('report.html', 'w') as f:
f.write(html_content)Interactive HTML file with embedded Plotly charts No external dependencies (charts embedded in HTML) Works offline, shareable via email
Each algorithm gets tailored visualizations:
Charts Generated:
- Top Influencers Bar Chart
- Shows top 20 nodes by PageRank score
- Hover to see exact scores
- Color-coded by influence level
- Rank Distribution Histogram
- Log-scale distribution of all ranks
- Identifies power-law patterns
- Highlights concentration
- Cumulative Influence
- Shows % of total influence by top N nodes
- "80/20 rule" visualization
- Helps identify critical nodes
Example Output:
Top 10 nodes control 82% of network influence
Charts Generated:
- Top 10 Largest Components
- Bar chart of component sizes
- Shows node counts per component
- Identifies main cluster
- Component Size Distribution
- Histogram of all component sizes
- Log-scale for skewed distributions
- Reveals fragmentation patterns
- Connectivity Overview (Pie Chart)
- Donut chart showing cluster breakdown
- Main cluster vs. others
- Total component count in center
Example Output:
4,534 distinct components identified
Main cluster: 155,131 nodes (97.43%)
Charts Generated:
- Top Bridge Nodes
- Bar chart of highest betweenness scores
- Identifies critical connection points
- Highlights network bottlenecks
- Betweenness Distribution
- Histogram of all betweenness values
- Log-scale for highly skewed data
- Shows bridge node rarity
Example Output:
7 critical bridge nodes connect all major clusters
Charts Generated:
- Top 10 Communities
- Bar chart of largest communities
- Member counts per community
- Community distribution
- Community Size Distribution
- Histogram of all community sizes
- Reveals clustering patterns
- Identifies dominant communities
Example Output:
12 major communities detected
Largest community: 45,000 members
Charts Generated:
- Same as WCC, with SCC-specific context
- Emphasizes bidirectional relationships
- Highlights cycle detection
- Algorithm and key metrics
- Total results processed
- Execution time
- Number of insights generated
- Algorithm-specific visualizations
- Embedded Plotly charts
- Fully interactive (hover, zoom, pan)
- AI-generated findings
- Confidence scores (0-100%)
- Business impact statements
- Color-coded by confidence level
- Prioritized action items
- High/Medium/Low priority
- Expected business impact
- Effort estimation
- Complete execution statistics
- Dataset information
- Algorithm-specific metrics
from graph_analytics_ai.ai.reporting import HTMLReportFormatter
# Modern theme (default)
formatter = HTMLReportFormatter(theme="modern")
# Classic theme
formatter = HTMLReportFormatter(theme="classic")
# Dark theme
formatter = HTMLReportFormatter(theme="dark")from graph_analytics_ai.ai.reporting import ChartGenerator
# Initialize with custom theme
chart_gen = ChartGenerator(theme="plotly_dark")
# Generate specific chart type
charts = chart_gen.generate_wcc_charts(results, top_n=20) # Show top 20 instead of 10# Generate markdown report without charts
generator = ReportGenerator(enable_charts=False)
report = generator.generate_report(execution_result)
markdown = generator.format_report(report, ReportFormat.MARKDOWN)from graph_analytics_ai.ai.agents import AgenticWorkflowRunner
# Run workflow with chart generation enabled
runner = AgenticWorkflowRunner(
db_connection=db,
llm_provider=llm,
core_collections=["Device", "IP", "AppProduct"],
satellite_collections=["Publisher", "Location"],
enable_tracing=True
)
result = runner.run(
use_case_file="use_cases.md",
output_dir="./workflow_output"
)
# Reports automatically generated with charts
# Located in: ./workflow_output/reports/*.htmlfrom graph_analytics_ai.ai.execution import AnalysisExecutor
from graph_analytics_ai.ai.reporting import ReportGenerator, HTMLReportFormatter
# Execute analysis
executor = AnalysisExecutor()
execution_result = executor.execute_template(template, wait=True)
# Generate report with charts
generator = ReportGenerator(enable_charts=True)
report = generator.generate_report(execution_result, context={
"use_case": {"title": "My Analysis"},
"requirements": {"domain": "my domain"}
})
# Save as HTML
html_formatter = HTMLReportFormatter()
charts = report.metadata.get('charts', {})
html_content = html_formatter.format_report(report, charts=charts)
with open('my_report.html', 'w') as f:
f.write(html_content)All charts include:
- Hover tooltips - Detailed information on hover
- Zoom & Pan - Explore data interactively
- Download - Export as PNG (Plotly toolbar)
- Responsive - Works on mobile/tablet/desktop
- Offline - No internet required after generation
- Fast generation: ~1-2 seconds for 100K+ results
- Small file size: ~500KB for full HTML report with 3 charts
- Browser compatibility: All modern browsers (Chrome, Firefox, Safari, Edge)
# Generate household identity resolution report
from graph_analytics_ai.ai.reporting import ReportGenerator, HTMLReportFormatter
generator = ReportGenerator(enable_charts=True, use_llm_interpretation=False)
report = generator.generate_report(
wcc_execution_result,
context={
"use_case": {
"title": "Household Identity Resolution",
"objective": "Group 159K devices into distinct household clusters"
},
"requirements": {
"domain": "advertising technology",
"objectives": [{
"title": "Cross-Device Attribution",
"success_criteria": [
"Identify 1000+ distinct household clusters",
"Main cluster < 98% of total devices"
]
}]
}
}
)
# Format and save
html_formatter = HTMLReportFormatter()
charts = report.metadata.get('charts', {})
html_content = html_formatter.format_report(report, charts=charts)
with open('household_identity_report.html', 'w') as f:
f.write(html_content)
print(f" Report generated: 4,534 households identified")
print(f" Charts: Component distribution, top clusters, connectivity")
print(f" Insights: {len(report.insights)} AI-generated findings")Output: Interactive HTML report showing:
- 4,534 distinct household clusters
- 155,131 devices in main cluster (97.43%)
- Top 10 largest households
- Component size distribution histogram
- Connectivity pie chart
- 5+ actionable insights with confidence scores
Issue: Reports have no charts
Solution:
# Check if plotly is installed
python -c "import plotly; print('Plotly installed')"
# If not, install it
pip install plotly
# Verify in code
from graph_analytics_ai.ai.reporting import is_plotly_available
print(is_plotly_available()) # Should print TrueIssue: HTML file is too large (>10MB)
Solution:
# Limit chart data points
generator = ReportGenerator(enable_charts=True)
# Manually generate charts with limits
from graph_analytics_ai.ai.reporting import ChartGenerator
chart_gen = ChartGenerator()
# Show top 10 instead of top 20
charts = chart_gen.generate_pagerank_charts(results[:1000], top_n=10)Issue: Charts appear as static images
Solution: Ensure you're opening the HTML file in a browser (not a text editor)
# macOS
open report.html
# Linux
xdg-open report.html
# Windows
start report.htmlclass ReportGenerator:
def __init__(
self,
llm_provider: Optional[LLMProvider] = None,
use_llm_interpretation: bool = True,
enable_charts: bool = True # NEW: Enable chart generation
)class ChartGenerator:
def generate_pagerank_charts(results, top_n=20) -> Dict[str, str]
def generate_wcc_charts(results, top_n=10) -> Dict[str, str]
def generate_betweenness_charts(results, top_n=20) -> Dict[str, str]
def generate_label_propagation_charts(results, top_n=10) -> Dict[str, str]
def generate_scc_charts(results, top_n=10) -> Dict[str, str]class HTMLReportFormatter:
def __init__(theme: str = "modern")
def format_report(
report: AnalysisReport,
charts: Optional[Dict[str, str]] = None,
include_raw_data: bool = False
) -> str- PDF Export - Convert HTML reports to PDF
- More Chart Types - Network graphs, heatmaps, sankey diagrams
- Custom Templates - User-defined HTML templates
- Dashboard View - Multi-report dashboard
- Real-time Updates - Live chart updates during execution
Have suggestions for chart improvements? Let us know!
- Execution Reporting Guide
- Report Generation Guide
- Agentic Workflow Guide
- Customer Project Instructions
Generated: December 22, 2025 Version: 1.1.0 Status: Production Ready