# Graph Store

## Description

Graph stores register through `IFlexGraphStore`, providing a provider-agnostic API for node/edge CRUD and traversals.

## Configuration in DI

Register only the provider.

```csharp
// Pick ONE
services.AddFlexNeo4jGraphStore(configuration);
// services.AddFlexCosmosGremlinGraphStore(configuration);
```

## appsettings.json

Graph store configuration is read from `FlexBase:DataStores:Graph:<Provider>`.

```json
{
	"FlexBase": {
		"DataStores": {
			"Graph": {
				"Neo4j": {
					"Uri": "bolt://localhost:7687",
					"Username": "neo4j",
					"Password": "<store-in-secrets>"
				}
			}
		}
	}
}
```

## Sample usage ({YourApplication})

```csharp
public class ConnectionFinder
{
	private readonly IFlexGraphStore _graphStore;

	public ConnectionFinder(IFlexGraphStore graphStore)
		=> _graphStore = graphStore;

	public Task<IReadOnlyList<FlexGraphNode>> FindPeopleAsync(CancellationToken ct = default)
		=> _graphStore.FindNodesAsync(label: "Person", limit: 50, ct: ct);
}
```

## Provider pages

* Neo4j: `graph-store/neo4j.md`
* Cosmos Gremlin: `graph-store/cosmos-gremlin.md`

## Provider considerations

* Graph providers vary in query language; prefer the structured `IFlexGraphStore` APIs for portability.
