Skip to content

Quick Start

Graphinate is designed to be used as a library first and foremost. In addition, it has several interfaces for ease of use: CLI and a GraphQL API (using **Strawberry GraphQL **).

Install

Graphinate is available on PyPI:

pip install graphinate

To install with server support

pip install graphinate[server]

Graphinate officially supports Python >= 3.10.

Demo

Octagonal Graph
import graphinate

N: int = 8

# Define a GraphModel
graph_model: graphinate.GraphModel = graphinate.model(name="Octagonal Graph")


# Register in the Graph Model the edges' supplier function
@graph_model.edge()
def edge():
    for i in range(N):
        yield {'source': i, 'target': i + 1}
    yield {'source': N, 'target': 0}


# Choose builder and handler
builder, handler = graphinate.materializers.Materializers.NetworkX_with_edge_labels.value

# Materialize the GraphModel
graphinate.materialize(graph_model, builder=builder, builder_output_handler=handler)