def test_05_delete_relationship_and_nodes(neo4j_graph_store: Neo4jGraphStore):
    """
    Test deleting an existing relationship (and subject/object if no other edges).
    """
    store = neo4j_graph_store
    store.upsert_triplet("X", "REL", "Y")

    # Confirm upsert worked
    results_before = store.get("X")
    assert len(results_before) == 1
    assert results_before[0] == ["REL", "Y"]

    # Delete that relationship
    store.delete("X", "REL", "Y")

    # Now both X and Y should be removed if no other edges remain.
    results_after = store.get("X")
    assert len(results_after) == 0

    Test deleting an existing relationship (and subject/object if no other edges).
    
llama-index-integrations/graph_stores/llama-index-graph-stores-neo4j/tests/test_graph_stores_neo4j.py