Skip to content

Operations

Graph analytics operations.

create_graph ¤

create_graph(bundle: Bundle, *, relations: str = None) -> Bundle

Replace relations of the given bundle

relations is a stringified JSON, instead of a dict, because complex Yjs types (arrays, maps) are not currently supported in the UI.

PARAMETER DESCRIPTION
bundle

Bundle to modify

TYPE: Bundle

relations

Set of relations to set for the bundle. The parameter should be a JSON object where the keys are relation names and the values are a dictionary representation of a RelationDefinition. Defaults to None.

TYPE: str DEFAULT: None

RETURNS DESCRIPTION
Bundle

The input bundle with the new relations set.

TYPE: Bundle

cypher ¤

cypher(bundle: Bundle, *, query: LongStr, save_as: str = 'result')

Run a Cypher query on the graph in the bundle. Save the results as a new DataFrame.

import_csv ¤

import_csv(*, filename: str, columns: str = '<from file>', separator: str = '<auto>')

Imports a CSV file.

import_file ¤

import_file(*, file_path: str, table_name: str, file_format: FileFormat, **kwargs) -> Bundle

Read the contents of the a file into a Bundle.

PARAMETER DESCRIPTION
file_path

Path to the file to import.

TYPE: str

table_name

Name to use for identifying the table in the bundle.

TYPE: str

file_format

Format of the file. Has to be one of the values in the FileFormat enum.

TYPE: FileFormat

RETURNS DESCRIPTION
Bundle

Bundle with a single table with the contents of the file.

TYPE: Bundle

import_graphml ¤

import_graphml(*, filename: str)

Imports a GraphML file.

import_parquet ¤

import_parquet(*, filename: str)

Imports a Parquet file.

organize ¤

organize(bundle: list[Bundle], *, code: LongStr) -> Bundle

Lets you rename/copy/delete DataFrames, and modify relations.

TODO: Merge this with "Create graph".

sample_graph ¤

sample_graph(graph: Graph, *, nodes: int = 100)

Takes a (preferably connected) subgraph.

sql ¤

sql(bundle: Bundle, *, query: LongStr, save_as: str = 'result')

Run a SQL query on the DataFrames in the bundle. Save the results as a new DataFrame.

Operations for machine learning.

define_model ¤

define_model(bundle: Bundle, *, model_workspace: str, save_as: str = 'model')

Trains the selected model on the selected dataset. Most training parameters are set in the model definition.

model_inference ¤

model_inference(bundle: Bundle, *, model_name: str = 'model', input_mapping: ModelInferenceInputMapping, output_mapping: ModelOutputMapping)

Executes a trained model.

train_model ¤

train_model(bundle: Bundle, *, model_name: str = 'model', input_mapping: ModelTrainingInputMapping, epochs: int = 1)

Trains the selected model on the selected dataset. Most training parameters are set in the model definition.

train_test_split ¤

train_test_split(bundle: Bundle, *, table_name: str, test_ratio: float = 0.1)

Splits a dataframe in the bundle into separate "_train" and "_test" dataframes.

Automatically wraps all NetworkX functions as LynxKite operations.