//! Basic Graph Operations Example //! //! This example demonstrates fundamental graph database operations: //! - Creating nodes with labels and properties //! - Creating relationships between nodes //! - Querying nodes and relationships //! - Updating and deleting graph elements fn main() { println!("=== RuVector Graph - Basic Operations ===\n"); // TODO: Once the graph API is exposed in ruvector-graph, implement: println!("1. Creating Graph Database"); // let db = GraphDatabase::open("./data/basic_graph.db")?; println!("2. Creating Nodes"); // Create person nodes // let alice = db.create_node() // .label("Person") // .property("name", "Alice") // .property("age", 30) // .execute()?; // let bob = db.create_node() // .label("Person") // .property("name", "Bob") // .property("age", 35) // .execute()?; println!(" ✓ Created nodes: Alice, Bob"); println!("\n3. Creating Relationships"); // Create friendship relationship // let friendship = db.create_relationship() // .from(alice) // .to(bob) // .type("FRIENDS_WITH") // .property("since", 2020) // .execute()?; println!(" ✓ Created relationship: Alice -[FRIENDS_WITH]-> Bob"); println!("\n4. Querying Nodes"); // Find all Person nodes // let people = db.query() // .match_pattern("(p:Person)") // .return_("p") // .execute()?; // for person in people { // println!(" Found: {:?}", person); // } println!("\n5. Traversing Relationships"); // Find Alice's friends // let friends = db.query() // .match_pattern("(a:Person {name: 'Alice'})-[:FRIENDS_WITH]->(friend)") // .return_("friend") // .execute()?; // println!(" Alice's friends: {:?}", friends); println!("\n6. Updating Properties"); // Update Alice's age // db.update_node(alice) // .property("age", 31) // .execute()?; println!(" ✓ Updated Alice's age"); println!("\n7. Deleting Elements"); // Delete a relationship // db.delete_relationship(friendship)?; println!(" ✓ Deleted friendship relationship"); println!("\n8. Statistics"); // let stats = db.stats()?; // println!(" Total nodes: {}", stats.node_count); // println!(" Total relationships: {}", stats.relationship_count); // println!(" Node labels: {:?}", stats.labels); // println!(" Relationship types: {:?}", stats.relationship_types); println!("\n=== Example Complete ==="); println!("\nNote: This is a template. Actual implementation pending graph API exposure."); }