TravelGraph-AI/Eval/KNOWLEDGE_GRAPH_EDA.md at main · Hotragn/TravelGraph-AI · GitHub
Skip to content

Latest commit

 

History

History
300 lines (199 loc) · 9.08 KB

KNOWLEDGE_GRAPH_EDA.md

File metadata and controls

300 lines (199 loc) · 9.08 KB

Knowledge Graph Exploratory Data Analysis

📊 Overview

This document presents a comprehensive exploratory data analysis (EDA) of the Travel Recommendation Knowledge Graph, containing 57,877 nodes and 55,131+ relationships across Massachusetts attractions.


🎯 Graph Summary Statistics

Key Metrics

Metric Count
Total Nodes 57,877
Total Relationships 55,131+
Node Types 300+
Relationship Types 60+
Cities 352
Attractions 19,883

Graph Summary


🔗 Entity-Relationship Matrix

The entity-relationship matrix shows how different entity types in the knowledge graph are connected. This heatmap uses a logarithmic scale to visualize the wide range of relationship counts (from single connections to tens of thousands).

Key Insights:

  • Strongest Connections: Attractions → Cities (13,519 relationships)
  • Rich Metadata: Extensive use of property relationships (BRAND, MEMBER_OF)
  • Hierarchical Structure: Clear geographic hierarchy (City → State → Country)

Entity-Relationship Matrix

Top Relationship Types

The most common relationship types reveal the graph's structure:

Relationship Types

Top 5 Relationships:

  1. MEMBER_OF (55,131) - Entity categorization
  2. BRAND (51,678) - Brand associations
  3. LOCATED_IN (13,519) - Geographic containment
  4. ADDRESS (5,405) - Location details
  5. HAS_WEBSITE (4,125) - Web presence

📍 Node Type Distribution

The knowledge graph contains diverse entity types, with natural features and businesses dominating the landscape.

Node Distribution

Top 10 Node Types:

Rank Node Type Count Percentage
1 NaturalWater 13,765 23.8%
2 Restaurant 4,813 8.3%
3 Pond 4,167 7.2%
4 Park 3,802 6.6%
5 FastFood 2,395 4.1%
6 WaterwayRiver 2,345 4.1%
7 Information 2,105 3.6%
8 Beach 2,053 3.5%
9 Cafe 1,202 2.1%
10 WaterReservoir 1,070 1.8%

Insights:

  • Natural Features Dominate: 40%+ of nodes are natural features (water bodies, parks, beaches)
  • Rich Dining Options: 8,410 food-related entities (restaurants, cafes, fast food)
  • Tourism Infrastructure: 444 museums, 220 theatres, significant cultural sites

🏙️ Geographic Distribution

Top Cities by Attraction Count

Massachusetts attractions are concentrated in major urban centers, with Boston leading significantly.

City-Attraction Distribution

Top 10 Cities:

Rank City Attractions Notable Features
1 Boston 2,847 Museums, restaurants, parks
2 Worcester 1,245 Cultural sites, dining
3 Springfield 892 Historic sites, parks
4 Cambridge 756 Academic, museums
5 Lowell 634 Industrial heritage
6 New Bedford 589 Maritime history
7 Brockton 512 Parks, recreation
8 Quincy 487 Coastal attractions
9 Lynn 445 Beaches, parks
10 Fall River 423 Historic sites

Geographic Insights:

  • Urban Concentration: Top 10 cities contain 45% of all attractions
  • Coastal Presence: Strong representation of coastal cities (New Bedford, Quincy, Lynn)
  • Diverse Distribution: 352 cities ensure statewide coverage

🎨 Advanced Visualizations

Radar Chart - Entity Type Distribution

Normalized distribution of major attraction types across the knowledge graph.

Radar Chart

Key Insights:

  • Restaurants dominate with highest normalized score (100%)
  • Parks and beaches show strong presence
  • Museums and theatres provide cultural diversity
  • Balanced distribution across attraction categories

Sunburst Chart - Hierarchical Structure

Interactive hierarchical view showing State → City → Attraction Type relationships.

Sunburst Chart

Hierarchical Insights:

  • Clear geographic hierarchy from state to city to attraction
  • Visual representation of attraction type diversity within cities
  • Size indicates relative count of each category

Treemap - Entity Distribution

Treemap visualization showing proportional distribution of entity types.

Treemap

Distribution Insights:

  • Visual comparison of entity type sizes
  • Color intensity represents entity count
  • Easy identification of dominant categories

Bubble Chart - City Analysis

Analyzes cities by total attraction count vs. attraction type diversity.

Bubble Chart

City Insights:

  • X-axis: Total number of attractions
  • Y-axis: Number of different attraction types
  • Bubble size: Total attraction count
  • Color: Diversity score
  • Boston shows both high count AND high diversity
  • Smaller cities may specialize in fewer attraction types

🎨 Graph Characteristics

Density and Connectivity

  • Graph Density: Low (typical for real-world knowledge graphs)
  • Average Degree: ~1.9 relationships per node
  • Hub Nodes: Cities serve as major hubs connecting attractions
  • Clustering: High clustering around geographic regions

Data Quality Indicators

✅ Strengths:

  • Comprehensive geographic coverage (352 cities)
  • Rich metadata (opening hours, addresses, websites for 60%+ of attractions)
  • Hierarchical structure (City → State → Country)
  • Diverse entity types (300+ categories)

⚠️ Areas for Enhancement:

  • Some attractions lack detailed descriptions
  • Operating hours missing for 35% of entities
  • Opportunity to add user reviews and ratings

🔍 Query Patterns

The graph structure supports various query patterns:

1. Spatial Queries

// Find restaurants within 2km of a museum
MATCH (m:Museum)-[:LOCATED_IN]->(c:City)
MATCH (r:Restaurant)-[:LOCATED_IN]->(c)
WHERE point.distance(m.location, r.location) < 2000
RETURN r.name, m.name

2. Hierarchical Queries

// Get all attractions in a state
MATCH (a:Attraction)-[:LOCATED_IN]->(c:City)-[:IN_STATE]->(s:State {name: 'MA'})
RETURN a.name, c.name

3. Categorical Queries

// Find all museums with websites
MATCH (m:Museum)-[:HAS_WEBSITE]->(w)
RETURN m.name, w.url

📈 Growth and Scalability

Current Scale

  • Nodes: 57,877
  • Relationships: 55,131+
  • Storage: Optimized with indexes on key properties
  • Query Performance: Sub-second for most queries

Scalability Considerations

  • Graph can easily scale to 100K+ nodes
  • Spatial indexes enable efficient proximity queries
  • Relationship-based traversals remain performant
  • Ready for real-time user interaction

🎯 Use Cases Enabled

This knowledge graph structure supports:

  1. Personalized Recommendations: Graph-based collaborative filtering
  2. Spatial Discovery: "Find attractions near me"
  3. Trip Planning: Multi-stop itinerary optimization
  4. Category Exploration: "Show all museums in Boston"
  5. Contextual Search: Natural language to Cypher translation

📊 Data Sources

  • Primary: OpenStreetMap (OSM) data for Massachusetts
  • Validation: Triple validation methodology (3-source verification)
  • Enrichment: LLM-generated descriptions for missing data
  • Updates: Periodic refresh from OSM

🔬 Methodology

All visualizations and statistics were generated using:

  • Database: Neo4j 5.27.0
  • Analysis: Python 3.10+ with pandas, matplotlib, seaborn
  • Reproducibility: All data exported to CSV in data_analysis/data/
  • Scripts: Available in Eval/data_analysis/

To reproduce:

cd Eval/data_analysis
python run_all_analysis.py

📝 Conclusion

The Travel Recommendation Knowledge Graph demonstrates:

  • ✅ Comprehensive Coverage: 19,883 attractions across 352 cities
  • ✅ Rich Structure: 55,131+ relationships enabling complex queries
  • ✅ High Quality: Triple-validated data with extensive metadata
  • ✅ Production-Ready: Optimized for real-time recommendation systems

This graph serves as the foundation for an intelligent, graph-powered travel recommendation system that leverages both structural relationships and semantic understanding.


Analysis Date: December 2025
Graph Version: 2.0.0
Analyst: TravelGraph-AI Team