diff --git a/.github/workflows/test_python_workflow.yml b/.github/workflows/test_python_workflow.yml
index 70443f3373..64b939b5e0 100644
--- a/.github/workflows/test_python_workflow.yml
+++ b/.github/workflows/test_python_workflow.yml
@@ -58,8 +58,12 @@ jobs:
cache: 'pip'
- name: Install Python dependencies
run: |
+ echo "Installing test dependencies..."
python -m pip install pytest tox
python -m pip install -e examples/netflow
+ python -m pip install black
+ echo "Installing linting dependencies from cache..."
+ python -m pip install maturin mypy networkx pyvis pandas-stubs
- name: Setup Node.js
uses: actions/setup-node@v4
with:
@@ -78,6 +82,22 @@ jobs:
if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13'
run: |
python docs/scripts/gen_docs_graphql_pages.py
+ - name: Run python linter
+ if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13'
+ run: |
+ cd python && black .
+ - name: Run stubsgen
+ if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13'
+ run: |
+ echo "Installing Raphtory from cache..."
+ pip install raphtory
+ echo "Installing stubsgen"
+ python -m pip install -e stub_gen
+ cd python/scripts && python gen-stubs.py
+ - name: Run mypy
+ run: |
+ mypy -m raphtory
+
- name: Check for uncommitted changes
if: matrix.os == 'ubuntu-latest' && matrix.python == '3.13'
diff --git a/docs/reference/graphql/graphql_API.md b/docs/reference/graphql/graphql_API.md
index f68731f57e..7a043124f7 100644
--- a/docs/reference/graphql/graphql_API.md
+++ b/docs/reference/graphql/graphql_API.md
@@ -1896,43 +1896,43 @@ Export all nodes and edges from this graph view to another existing graph
-shortest_path |
-[ShortestPathOutput!]! |
+ |
+[PagerankOutput!]! |
|
-source |
-String! |
+iterCount |
+Int! |
|
-targets |
-[String!]! |
+threads |
+Int |
|
-direction |
-String |
+tol |
+Float |
|
- |
-[PagerankOutput!]! |
+shortest_path |
+[ShortestPathOutput!]! |
|
-iterCount |
-Int! |
+source |
+String! |
|
-threads |
-Int |
+targets |
+[String!]! |
|
-tol |
-Float |
+direction |
+String |
|
diff --git a/python/python/raphtory/__init__.pyi b/python/python/raphtory/__init__.pyi
index 89ed3fac55..3c034cf185 100644
--- a/python/python/raphtory/__init__.pyi
+++ b/python/python/raphtory/__init__.pyi
@@ -1,7 +1,6 @@
"""
Raphtory graph analytics library
"""
-
from __future__ import annotations
###############################################################################
@@ -26,39 +25,8 @@ from os import PathLike
import networkx as nx # type: ignore
import pyvis # type: ignore
-__all__ = [
- "GraphView",
- "Graph",
- "PersistentGraph",
- "Node",
- "Nodes",
- "PathFromNode",
- "PathFromGraph",
- "MutableNode",
- "Edge",
- "Edges",
- "NestedEdges",
- "MutableEdge",
- "Properties",
- "Metadata",
- "TemporalProperties",
- "PropertiesView",
- "TemporalProp",
- "WindowSet",
- "IndexSpecBuilder",
- "IndexSpec",
- "graphql",
- "algorithms",
- "graph_loader",
- "graph_gen",
- "vectors",
- "node_state",
- "filter",
- "nullmodels",
- "plottingutils",
-]
-
-class GraphView(object):
+__all__ = ['GraphView', 'Graph', 'PersistentGraph', 'Node', 'Nodes', 'PathFromNode', 'PathFromGraph', 'MutableNode', 'Edge', 'Edges', 'NestedEdges', 'MutableEdge', 'Properties', 'Metadata', 'TemporalProperties', 'PropertiesView', 'TemporalProp', 'WindowSet', 'IndexSpecBuilder', 'IndexSpec', 'graphql', 'algorithms', 'graph_loader', 'graph_gen', 'vectors', 'node_state', 'filter', 'nullmodels', 'plottingutils']
+class GraphView(object):
"""Graph view is a read-only version of a graph at a certain point in time."""
def __eq__(self, value):
@@ -604,14 +572,7 @@ class GraphView(object):
GraphView: Returns the subgraph
"""
- def to_networkx(
- self,
- explode_edges: bool = False,
- include_node_properties: bool = True,
- include_edge_properties: bool = True,
- include_update_history: bool = True,
- include_property_history: bool = True,
- ) -> nx.MultiDiGraph:
+ def to_networkx(self, explode_edges: bool = False, include_node_properties: bool = True, include_edge_properties: bool = True, include_update_history: bool = True, include_property_history: bool = True) -> nx.MultiDiGraph:
"""
Returns a graph with NetworkX.
@@ -630,19 +591,7 @@ class GraphView(object):
nx.MultiDiGraph: A Networkx MultiDiGraph.
"""
- def to_pyvis(
- self,
- explode_edges: bool = False,
- edge_color: str = "#000000",
- shape: str = "dot",
- node_image: Optional[str] = None,
- edge_weight: Optional[str] = None,
- edge_label: Optional[str] = None,
- colour_nodes_by_type: bool = False,
- directed: bool = True,
- notebook: bool = False,
- **kwargs: Any,
- ) -> pyvis.network.Network:
+ def to_pyvis(self, explode_edges: bool = False, edge_color: str = '#000000', shape: str = 'dot', node_image: Optional[str] = None, edge_weight: Optional[str] = None, edge_label: Optional[str] = None, colour_nodes_by_type: bool = False, directed: bool = True, notebook: bool = False, **kwargs: Any) -> pyvis.network.Network:
"""
Draw a graph with PyVis.
Pyvis is a required dependency. If you intend to use this function make sure that you install Pyvis
@@ -703,14 +652,7 @@ class GraphView(object):
GraphView: The layered view
"""
- def vectorise(
- self,
- embedding: Callable[[list], list],
- nodes: bool | str = True,
- edges: bool | str = True,
- cache: Optional[str] = None,
- verbose: bool = False,
- ) -> VectorisedGraph:
+ def vectorise(self, embedding: Callable[[list], list], nodes: bool | str = True, edges: bool | str = True, cache: Optional[str] = None, verbose: bool = False) -> VectorisedGraph:
"""
Create a VectorisedGraph from the current graph
@@ -746,7 +688,7 @@ class GraphView(object):
Optional[int]:
"""
-class Graph(GraphView):
+class Graph(GraphView):
"""
A temporal graph with event semantics.
@@ -757,16 +699,10 @@ class Graph(GraphView):
def __new__(cls, num_shards: Optional[int] = None) -> Graph:
"""Create and return a new object. See help(type) for accurate signature."""
- def __reduce__(self): ...
- def add_edge(
- self,
- timestamp: TimeInput,
- src: str | int,
- dst: str | int,
- properties: Optional[PropInput] = None,
- layer: Optional[str] = None,
- secondary_index: Optional[int] = None,
- ) -> MutableEdge:
+ def __reduce__(self):
+ ...
+
+ def add_edge(self, timestamp: TimeInput, src: str|int, dst: str|int, properties: Optional[PropInput] = None, layer: Optional[str] = None, secondary_index: Optional[int] = None) -> MutableEdge:
"""
Adds a new edge with the given source and destination nodes and properties to the graph.
@@ -799,14 +735,7 @@ class Graph(GraphView):
GraphError: If the operation fails.
"""
- def add_node(
- self,
- timestamp: TimeInput,
- id: str | int,
- properties: Optional[PropInput] = None,
- node_type: Optional[str] = None,
- secondary_index: Optional[int] = None,
- ) -> MutableNode:
+ def add_node(self, timestamp: TimeInput, id: str|int, properties: Optional[PropInput] = None, node_type: Optional[str] = None, secondary_index: Optional[int] = None) -> MutableNode:
"""
Adds a new node with the given id and properties to the graph.
@@ -824,12 +753,7 @@ class Graph(GraphView):
GraphError: If the operation fails.
"""
- def add_properties(
- self,
- timestamp: TimeInput,
- properties: PropInput,
- secondary_index: Optional[int] = None,
- ) -> None:
+ def add_properties(self, timestamp: TimeInput, properties: PropInput, secondary_index: Optional[int] = None) -> None:
"""
Adds properties to the graph.
@@ -881,14 +805,7 @@ class Graph(GraphView):
def create_index_with_spec(self, py_spec):
"""Create graph index with the provided index spec."""
- def create_node(
- self,
- timestamp: TimeInput,
- id: str | int,
- properties: Optional[PropInput] = None,
- node_type: Optional[str] = None,
- secondary_index: Optional[int] = None,
- ) -> MutableNode:
+ def create_node(self, timestamp: TimeInput, id: str|int, properties: Optional[PropInput] = None, node_type: Optional[str] = None, secondary_index: Optional[int] = None) -> MutableNode:
"""
Creates a new node with the given id and properties to the graph. It fails if the node already exists.
@@ -918,7 +835,7 @@ class Graph(GraphView):
Graph:
"""
- def edge(self, src: str | int, dst: str | int) -> MutableEdge:
+ def edge(self, src: str|int, dst: str|int) -> MutableEdge:
"""
Gets the edge with the specified source and destination nodes
@@ -1011,9 +928,7 @@ class Graph(GraphView):
GraphError: If the operation fails.
"""
- def import_edges_as(
- self, edges: List[Edge], new_ids: List[Tuple[int, int]], merge: bool = False
- ) -> None:
+ def import_edges_as(self, edges: List[Edge], new_ids: List[Tuple[int, int]], merge: bool = False) -> None:
"""
Import multiple edges into the graph with new ids.
@@ -1048,9 +963,7 @@ class Graph(GraphView):
GraphError: If the operation fails.
"""
- def import_node_as(
- self, node: Node, new_id: str | int, merge: bool = False
- ) -> MutableNode:
+ def import_node_as(self, node: Node, new_id: str|int, merge: bool = False) -> MutableNode:
"""
Import a single node into the graph with new id.
@@ -1085,9 +998,7 @@ class Graph(GraphView):
GraphError: If the operation fails.
"""
- def import_nodes_as(
- self, nodes: List[Node], new_ids: List[str | int], merge: bool = False
- ) -> None:
+ def import_nodes_as(self, nodes: List[Node], new_ids: List[str|int], merge: bool = False) -> None:
"""
Import multiple nodes into the graph with new ids.
@@ -1132,16 +1043,7 @@ class Graph(GraphView):
Graph: the loaded graph with initialised cache
"""
- def load_edge_props_from_pandas(
- self,
- df: DataFrame,
- src: str,
- dst: str,
- metadata: Optional[List[str]] = None,
- shared_metadata: Optional[PropInput] = None,
- layer: Optional[str] = None,
- layer_col: Optional[str] = None,
- ) -> None:
+ def load_edge_props_from_pandas(self, df: DataFrame, src: str, dst: str, metadata: Optional[List[str]] = None, shared_metadata: Optional[PropInput] = None, layer: Optional[str] = None, layer_col: Optional[str] = None) -> None:
"""
Load edge properties from a Pandas DataFrame.
@@ -1161,16 +1063,7 @@ class Graph(GraphView):
GraphError: If the operation fails.
"""
- def load_edge_props_from_parquet(
- self,
- parquet_path: str,
- src: str,
- dst: str,
- metadata: Optional[List[str]] = None,
- shared_metadata: Optional[PropInput] = None,
- layer: Optional[str] = None,
- layer_col: Optional[str] = None,
- ) -> None:
+ def load_edge_props_from_parquet(self, parquet_path: str, src: str, dst: str, metadata: Optional[List[str]] = None, shared_metadata: Optional[PropInput] = None, layer: Optional[str] = None, layer_col: Optional[str] = None) -> None:
"""
Load edge properties from parquet file
@@ -1190,18 +1083,7 @@ class Graph(GraphView):
GraphError: If the operation fails.
"""
- def load_edges_from_pandas(
- self,
- df: DataFrame,
- time: str,
- src: str,
- dst: str,
- properties: Optional[List[str]] = None,
- metadata: Optional[List[str]] = None,
- shared_metadata: Optional[PropInput] = None,
- layer: Optional[str] = None,
- layer_col: Optional[str] = None,
- ) -> None:
+ def load_edges_from_pandas(self, df: DataFrame, time: str, src: str, dst: str, properties: Optional[List[str]] = None, metadata: Optional[List[str]] = None, shared_metadata: Optional[PropInput] = None, layer: Optional[str] = None, layer_col: Optional[str] = None) -> None:
"""
Load edges from a Pandas DataFrame into the graph.
@@ -1223,18 +1105,7 @@ class Graph(GraphView):
GraphError: If the operation fails.
"""
- def load_edges_from_parquet(
- self,
- parquet_path: str,
- time: str,
- src: str,
- dst: str,
- properties: Optional[List[str]] = None,
- metadata: Optional[List[str]] = None,
- shared_metadata: Optional[PropInput] = None,
- layer: Optional[str] = None,
- layer_col: Optional[str] = None,
- ) -> None:
+ def load_edges_from_parquet(self, parquet_path: str, time: str, src: str, dst: str, properties: Optional[List[str]] = None, metadata: Optional[List[str]] = None, shared_metadata: Optional[PropInput] = None, layer: Optional[str] = None, layer_col: Optional[str] = None) -> None:
"""
Load edges from a Parquet file into the graph.
@@ -1268,15 +1139,7 @@ class Graph(GraphView):
Graph:
"""
- def load_node_props_from_pandas(
- self,
- df: DataFrame,
- id: str,
- node_type: Optional[str] = None,
- node_type_col: Optional[str] = None,
- metadata: Optional[List[str]] = None,
- shared_metadata: Optional[PropInput] = None,
- ) -> None:
+ def load_node_props_from_pandas(self, df: DataFrame, id: str, node_type: Optional[str] = None, node_type_col: Optional[str] = None, metadata: Optional[List[str]] = None, shared_metadata: Optional[PropInput] = None) -> None:
"""
Load node properties from a Pandas DataFrame.
@@ -1295,15 +1158,7 @@ class Graph(GraphView):
GraphError: If the operation fails.
"""
- def load_node_props_from_parquet(
- self,
- parquet_path: str,
- id: str,
- node_type: Optional[str] = None,
- node_type_col: Optional[str] = None,
- metadata: Optional[List[str]] = None,
- shared_metadata: Optional[PropInput] = None,
- ) -> None:
+ def load_node_props_from_parquet(self, parquet_path: str, id: str, node_type: Optional[str] = None, node_type_col: Optional[str] = None, metadata: Optional[List[str]] = None, shared_metadata: Optional[PropInput] = None) -> None:
"""
Load node properties from a parquet file.
@@ -1322,17 +1177,7 @@ class Graph(GraphView):
GraphError: If the operation fails.
"""
- def load_nodes_from_pandas(
- self,
- df: DataFrame,
- time: str,
- id: str,
- node_type: Optional[str] = None,
- node_type_col: Optional[str] = None,
- properties: Optional[List[str]] = None,
- metadata: Optional[List[str]] = None,
- shared_metadata: Optional[PropInput] = None,
- ) -> None:
+ def load_nodes_from_pandas(self, df: DataFrame, time: str, id: str, node_type: Optional[str] = None, node_type_col: Optional[str] = None, properties: Optional[List[str]] = None, metadata: Optional[List[str]] = None, shared_metadata: Optional[PropInput] = None) -> None:
"""
Load nodes from a Pandas DataFrame into the graph.
@@ -1353,17 +1198,7 @@ class Graph(GraphView):
GraphError: If the operation fails.
"""
- def load_nodes_from_parquet(
- self,
- parquet_path: str,
- time: str,
- id: str,
- node_type: Optional[str] = None,
- node_type_col: Optional[str] = None,
- properties: Optional[List[str]] = None,
- metadata: Optional[List[str]] = None,
- shared_metadata: Optional[PropInput] = None,
- ) -> None:
+ def load_nodes_from_parquet(self, parquet_path: str, time: str, id: str, node_type: Optional[str] = None, node_type_col: Optional[str] = None, properties: Optional[List[str]] = None, metadata: Optional[List[str]] = None, shared_metadata: Optional[PropInput] = None) -> None:
"""
Load nodes from a Parquet file into the graph.
@@ -1384,7 +1219,7 @@ class Graph(GraphView):
GraphError: If the operation fails.
"""
- def node(self, id: str | int) -> MutableNode:
+ def node(self, id: str|int) -> MutableNode:
"""
Gets the node with the specified id
@@ -1463,22 +1298,16 @@ class Graph(GraphView):
None:
"""
-class PersistentGraph(GraphView):
+class PersistentGraph(GraphView):
"""A temporal graph that allows edges and nodes to be deleted."""
def __new__(cls) -> PersistentGraph:
"""Create and return a new object. See help(type) for accurate signature."""
- def __reduce__(self): ...
- def add_edge(
- self,
- timestamp: int,
- src: str | int,
- dst: str | int,
- properties: Optional[PropInput] = None,
- layer: Optional[str] = None,
- secondary_index: Optional[int] = None,
- ) -> None:
+ def __reduce__(self):
+ ...
+
+ def add_edge(self, timestamp: int, src: str | int, dst: str | int, properties: Optional[PropInput] = None, layer: Optional[str] = None, secondary_index: Optional[int] = None) -> None:
"""
Adds a new edge with the given source and destination nodes and properties to the graph.
@@ -1511,14 +1340,7 @@ class PersistentGraph(GraphView):
GraphError: If the operation fails.
"""
- def add_node(
- self,
- timestamp: TimeInput,
- id: str | int,
- properties: Optional[PropInput] = None,
- node_type: Optional[str] = None,
- secondary_index: Optional[int] = None,
- ) -> None:
+ def add_node(self, timestamp: TimeInput, id: str | int, properties: Optional[PropInput] = None, node_type: Optional[str] = None, secondary_index: Optional[int] = None) -> None:
"""
Adds a new node with the given id and properties to the graph.
@@ -1536,12 +1358,7 @@ class PersistentGraph(GraphView):
GraphError: If the operation fails.
"""
- def add_properties(
- self,
- timestamp: TimeInput,
- properties: dict,
- secondary_index: Optional[int] = None,
- ) -> None:
+ def add_properties(self, timestamp: TimeInput, properties: dict, secondary_index: Optional[int] = None) -> None:
"""
Adds properties to the graph.
@@ -1593,14 +1410,7 @@ class PersistentGraph(GraphView):
def create_index_with_spec(self, py_spec):
"""Create graph index with the provided index spec."""
- def create_node(
- self,
- timestamp: TimeInput,
- id: str | int,
- properties: Optional[PropInput] = None,
- node_type: Optional[str] = None,
- secondary_index: Optional[int] = None,
- ) -> MutableNode:
+ def create_node(self, timestamp: TimeInput, id: str | int, properties: Optional[PropInput] = None, node_type: Optional[str] = None, secondary_index: Optional[int] = None) -> MutableNode:
"""
Creates a new node with the given id and properties to the graph. It fails if the node already exists.
@@ -1618,14 +1428,7 @@ class PersistentGraph(GraphView):
GraphError: If the operation fails.
"""
- def delete_edge(
- self,
- timestamp: int,
- src: str | int,
- dst: str | int,
- layer: Optional[str] = None,
- secondary_index: Optional[int] = None,
- ) -> MutableEdge:
+ def delete_edge(self, timestamp: int, src: str | int, dst: str | int, layer: Optional[str] = None, secondary_index: Optional[int] = None) -> MutableEdge:
"""
Deletes an edge given the timestamp, src and dst nodes and layer (optional)
@@ -1738,9 +1541,7 @@ class PersistentGraph(GraphView):
GraphError: If the operation fails.
"""
- def import_edges_as(
- self, edges: List[Edge], new_ids: list[Tuple[GID, GID]], merge: bool = False
- ) -> None:
+ def import_edges_as(self, edges: List[Edge], new_ids: list[Tuple[GID, GID]], merge: bool = False) -> None:
"""
Import multiple edges into the graph with new ids.
@@ -1777,9 +1578,7 @@ class PersistentGraph(GraphView):
GraphError: If the operation fails.
"""
- def import_node_as(
- self, node: Node, new_id: str | int, merge: bool = False
- ) -> Node:
+ def import_node_as(self, node: Node, new_id: str|int, merge: bool = False) -> Node:
"""
Import a single node into the graph with new id.
@@ -1816,9 +1615,7 @@ class PersistentGraph(GraphView):
GraphError: If the operation fails.
"""
- def import_nodes_as(
- self, nodes: List[Node], new_ids: List[str | int], merge: bool = False
- ) -> None:
+ def import_nodes_as(self, nodes: List[Node], new_ids: List[str|int], merge: bool = False) -> None:
"""
Import multiple nodes into the graph with new ids.
@@ -1852,15 +1649,7 @@ class PersistentGraph(GraphView):
PersistentGraph: the loaded graph with initialised cache
"""
- def load_edge_deletions_from_pandas(
- self,
- df: DataFrame,
- time: str,
- src: str,
- dst: str,
- layer: Optional[str] = None,
- layer_col: Optional[str] = None,
- ) -> None:
+ def load_edge_deletions_from_pandas(self, df: DataFrame, time: str, src: str, dst: str, layer: Optional[str] = None, layer_col: Optional[str] = None) -> None:
"""
Load edges deletions from a Pandas DataFrame into the graph.
@@ -1879,15 +1668,7 @@ class PersistentGraph(GraphView):
GraphError: If the operation fails.
"""
- def load_edge_deletions_from_parquet(
- self,
- parquet_path: str,
- time: str,
- src: str,
- dst: str,
- layer: Optional[str] = None,
- layer_col: Optional[str] = None,
- ) -> None:
+ def load_edge_deletions_from_parquet(self, parquet_path: str, time: str, src: str, dst: str, layer: Optional[str] = None, layer_col: Optional[str] = None) -> None:
"""
Load edges deletions from a Parquet file into the graph.
@@ -1906,16 +1687,7 @@ class PersistentGraph(GraphView):
GraphError: If the operation fails.
"""
- def load_edge_props_from_pandas(
- self,
- df: DataFrame,
- src: str,
- dst: str,
- metadata: Optional[List[str]] = None,
- shared_metadata: Optional[PropInput] = None,
- layer: Optional[str] = None,
- layer_col: Optional[str] = None,
- ) -> None:
+ def load_edge_props_from_pandas(self, df: DataFrame, src: str, dst: str, metadata: Optional[List[str]] = None, shared_metadata: Optional[PropInput] = None, layer: Optional[str] = None, layer_col: Optional[str] = None) -> None:
"""
Load edge properties from a Pandas DataFrame.
@@ -1935,16 +1707,7 @@ class PersistentGraph(GraphView):
GraphError: If the operation fails.
"""
- def load_edge_props_from_parquet(
- self,
- parquet_path: str,
- src: str,
- dst: str,
- metadata: Optional[List[str]] = None,
- shared_metadata: Optional[PropInput] = None,
- layer: Optional[str] = None,
- layer_col: Optional[str] = None,
- ) -> None:
+ def load_edge_props_from_parquet(self, parquet_path: str, src: str, dst: str, metadata: Optional[List[str]] = None, shared_metadata: Optional[PropInput] = None, layer: Optional[str] = None, layer_col: Optional[str] = None) -> None:
"""
Load edge properties from parquet file
@@ -1964,18 +1727,7 @@ class PersistentGraph(GraphView):
GraphError: If the operation fails.
"""
- def load_edges_from_pandas(
- self,
- df: DataFrame,
- time: str,
- src: str,
- dst: str,
- properties: Optional[List[str]] = None,
- metadata: Optional[List[str]] = None,
- shared_metadata: Optional[PropInput] = None,
- layer: Optional[str] = None,
- layer_col: Optional[str] = None,
- ) -> None:
+ def load_edges_from_pandas(self, df: DataFrame, time: str, src: str, dst: str, properties: Optional[List[str]] = None, metadata: Optional[List[str]] = None, shared_metadata: Optional[PropInput] = None, layer: Optional[str] = None, layer_col: Optional[str] = None) -> None:
"""
Load edges from a Pandas DataFrame into the graph.
@@ -1997,18 +1749,7 @@ class PersistentGraph(GraphView):
GraphError: If the operation fails.
"""
- def load_edges_from_parquet(
- self,
- parquet_path: str,
- time: str,
- src: str,
- dst: str,
- properties: Optional[List[str]] = None,
- metadata: Optional[List[str]] = None,
- shared_metadata: Optional[PropInput] = None,
- layer: Optional[str] = None,
- layer_col: Optional[str] = None,
- ) -> None:
+ def load_edges_from_parquet(self, parquet_path: str, time: str, src: str, dst: str, properties: Optional[List[str]] = None, metadata: Optional[List[str]] = None, shared_metadata: Optional[PropInput] = None, layer: Optional[str] = None, layer_col: Optional[str] = None) -> None:
"""
Load edges from a Parquet file into the graph.
@@ -2042,15 +1783,7 @@ class PersistentGraph(GraphView):
PersistentGraph:
"""
- def load_node_props_from_pandas(
- self,
- df: DataFrame,
- id: str,
- node_type: Optional[str] = None,
- node_type_col: Optional[str] = None,
- metadata: Optional[List[str]] = None,
- shared_metadata: Optional[PropInput] = None,
- ) -> None:
+ def load_node_props_from_pandas(self, df: DataFrame, id: str, node_type: Optional[str] = None, node_type_col: Optional[str] = None, metadata: Optional[List[str]] = None, shared_metadata: Optional[PropInput] = None) -> None:
"""
Load node properties from a Pandas DataFrame.
@@ -2069,15 +1802,7 @@ class PersistentGraph(GraphView):
GraphError: If the operation fails.
"""
- def load_node_props_from_parquet(
- self,
- parquet_path: str,
- id: str,
- node_type: Optional[str] = None,
- node_type_col: Optional[str] = None,
- metadata: Optional[List[str]] = None,
- shared_metadata: Optional[PropInput] = None,
- ) -> None:
+ def load_node_props_from_parquet(self, parquet_path: str, id: str, node_type: Optional[str] = None, node_type_col: Optional[str] = None, metadata: Optional[List[str]] = None, shared_metadata: Optional[PropInput] = None) -> None:
"""
Load node properties from a parquet file.
@@ -2096,17 +1821,7 @@ class PersistentGraph(GraphView):
GraphError: If the operation fails.
"""
- def load_nodes_from_pandas(
- self,
- df: DataFrame,
- time: str,
- id: str,
- node_type: Optional[str] = None,
- node_type_col: Optional[str] = None,
- properties: Optional[List[str]] = None,
- metadata: Optional[List[str]] = None,
- shared_metadata: Optional[PropInput] = None,
- ) -> None:
+ def load_nodes_from_pandas(self, df: DataFrame, time: str, id: str, node_type: Optional[str] = None, node_type_col: Optional[str] = None, properties: Optional[List[str]] = None, metadata: Optional[List[str]] = None, shared_metadata: Optional[PropInput] = None) -> None:
"""
Load nodes from a Pandas DataFrame into the graph.
@@ -2127,17 +1842,7 @@ class PersistentGraph(GraphView):
GraphError: If the operation fails.
"""
- def load_nodes_from_parquet(
- self,
- parquet_path: str,
- time: str,
- id: str,
- node_type: Optional[str] = None,
- node_type_col: Optional[str] = None,
- properties: Optional[List[str]] = None,
- metadata: Optional[List[str]] = None,
- shared_metadata: Optional[PropInput] = None,
- ) -> None:
+ def load_nodes_from_parquet(self, parquet_path: str, time: str, id: str, node_type: Optional[str] = None, node_type_col: Optional[str] = None, properties: Optional[List[str]] = None, metadata: Optional[List[str]] = None, shared_metadata: Optional[PropInput] = None) -> None:
"""
Load nodes from a Parquet file into the graph.
@@ -2228,7 +1933,7 @@ class PersistentGraph(GraphView):
None:
"""
-class Node(object):
+class Node(object):
"""A node (or node) in the graph."""
def __eq__(self, value):
@@ -2479,7 +2184,7 @@ class Node(object):
"""
@property
- def id(self) -> str | int:
+ def id(self) -> (str|int):
"""
Returns the id of the node.
This is a unique identifier for the node.
@@ -2770,7 +2475,7 @@ class Node(object):
Optional[int]:
"""
-class Nodes(object):
+class Nodes(object):
"""A list of nodes that can be iterated over."""
def __bool__(self):
@@ -3285,9 +2990,7 @@ class Nodes(object):
Optional[datetime]: The earliest datetime that this Nodes is valid or None if the Nodes is valid for all times.
"""
- def to_df(
- self, include_property_history: bool = False, convert_datetime: bool = False
- ) -> DataFrame:
+ def to_df(self, include_property_history: bool = False, convert_datetime: bool = False) -> DataFrame:
"""
Converts the graph's nodes into a Pandas DataFrame.
@@ -3348,7 +3051,8 @@ class Nodes(object):
Optional[int]:
"""
-class PathFromNode(object):
+class PathFromNode(object):
+
def __bool__(self):
"""True if self else False"""
@@ -3798,7 +3502,8 @@ class PathFromNode(object):
Optional[int]:
"""
-class PathFromGraph(object):
+class PathFromGraph(object):
+
def __bool__(self):
"""True if self else False"""
@@ -4257,7 +3962,8 @@ class PathFromGraph(object):
Optional[int]:
"""
-class MutableNode(Node):
+class MutableNode(Node):
+
def __repr__(self):
"""Return repr(self)."""
@@ -4271,12 +3977,7 @@ class MutableNode(Node):
metadata (PropInput): A dictionary of properties to be added to the node. Each key is a string representing the property name, and each value is of type Prop representing the property value.
"""
- def add_updates(
- self,
- t: TimeInput,
- properties: Optional[PropInput] = None,
- secondary_index: Optional[int] = None,
- ) -> None:
+ def add_updates(self, t: TimeInput, properties: Optional[PropInput] = None, secondary_index: Optional[int] = None) -> None:
"""
Add updates to a node in the graph at a specified time.
This function allows for the addition of property updates to a node within the graph. The updates are time-stamped, meaning they are applied at the specified time.
@@ -4315,7 +4016,7 @@ class MutableNode(Node):
metadata (PropInput): A dictionary of properties to be added to the node. Each key is a string representing the property name, and each value is of type Prop representing the property value.
"""
-class Edge(object):
+class Edge(object):
"""
PyEdge is a Python class that represents an edge in the graph.
An edge is a directed connection between two nodes.
@@ -4811,7 +4512,7 @@ class Edge(object):
Optional[int]:
"""
-class Edges(object):
+class Edges(object):
"""A list of edges that can be iterated over."""
def __bool__(self):
@@ -5025,7 +4726,9 @@ class Edges(object):
"""
- def history_counts(self): ...
+ def history_counts(self):
+ ...
+
def history_date_time(self):
"""
Returns all timestamps of edges, when an edge is added or change to an edge is made.
@@ -5039,7 +4742,9 @@ class Edges(object):
def id(self):
"""Returns all ids of the edges."""
- def is_active(self): ...
+ def is_active(self):
+ ...
+
def is_deleted(self):
"""Check if the edges are deleted"""
@@ -5241,12 +4946,7 @@ class Edges(object):
Time of edge
"""
- def to_df(
- self,
- include_property_history: bool = True,
- convert_datetime: bool = False,
- explode: bool = False,
- ) -> DataFrame:
+ def to_df(self, include_property_history: bool = True, convert_datetime: bool = False, explode: bool = False) -> DataFrame:
"""
Converts the graph's edges into a Pandas DataFrame.
@@ -5299,7 +4999,8 @@ class Edges(object):
Optional[int]:
"""
-class NestedEdges(object):
+class NestedEdges(object):
+
def __bool__(self):
"""True if self else False"""
@@ -5494,7 +5195,9 @@ class NestedEdges(object):
def id(self):
"""Returns all ids of the edges."""
- def is_active(self): ...
+ def is_active(self):
+ ...
+
def is_deleted(self):
"""Check if edges are deleted"""
@@ -5694,7 +5397,8 @@ class NestedEdges(object):
Optional[int]:
"""
-class MutableEdge(Edge):
+class MutableEdge(Edge):
+
def __repr__(self):
"""Return repr(self)."""
@@ -5709,13 +5413,7 @@ class MutableEdge(Edge):
layer (str, optional): The layer you want these properties to be added on to.
"""
- def add_updates(
- self,
- t: TimeInput,
- properties: Optional[PropInput] = None,
- layer: Optional[str] = None,
- secondary_index: Optional[int] = None,
- ) -> None:
+ def add_updates(self, t: TimeInput, properties: Optional[PropInput] = None, layer: Optional[str] = None, secondary_index: Optional[int] = None) -> None:
"""
Add updates to an edge in the graph at a specified time.
This function allows for the addition of property updates to an edge within the graph. The updates are time-stamped, meaning they are applied at the specified time.
@@ -5753,7 +5451,7 @@ class MutableEdge(Edge):
layer (str, optional): The layer you want these properties to be added on to.
"""
-class Properties(object):
+class Properties(object):
"""A view of the properties of an entity"""
def __contains__(self, key):
@@ -5813,7 +5511,7 @@ class Properties(object):
def values(self):
"""Get the values of the properties"""
-class Metadata(object):
+class Metadata(object):
"""A view of metadata of an entity"""
def __contains__(self, key):
@@ -5894,7 +5592,7 @@ class Metadata(object):
list | Array: the property values
"""
-class TemporalProperties(object):
+class TemporalProperties(object):
"""A view of the temporal properties of an entity"""
def __contains__(self, key):
@@ -5976,7 +5674,8 @@ class TemporalProperties(object):
list[TemporalProp]: the list of property views
"""
-class PropertiesView(object):
+class PropertiesView(object):
+
def __contains__(self, key):
"""Return bool(key in self)."""
@@ -6026,7 +5725,7 @@ class PropertiesView(object):
def values(self):
"""Get the values of the properties"""
-class TemporalProp(object):
+class TemporalProp(object):
"""A view of a temporal property"""
def __eq__(self, value):
@@ -6136,7 +5835,8 @@ class TemporalProp(object):
def values(self):
"""Get the property values for each update"""
-class WindowSet(object):
+class WindowSet(object):
+
def __iter__(self):
"""Implement iter(self)."""
@@ -6154,31 +5854,61 @@ class WindowSet(object):
Iterable: the time index"
"""
-class IndexSpecBuilder(object):
+class IndexSpecBuilder(object):
+
def __new__(cls, graph) -> IndexSpecBuilder:
"""Create and return a new object. See help(type) for accurate signature."""
- def build(self): ...
- def with_all_edge_metadata(self): ...
- def with_all_edge_properties(self): ...
- def with_all_edge_properties_and_metadata(self): ...
- def with_all_node_metadata(self): ...
- def with_all_node_properties(self): ...
- def with_all_node_properties_and_metadata(self): ...
- def with_edge_metadata(self, props): ...
- def with_edge_properties(self, props): ...
- def with_node_metadata(self, props): ...
- def with_node_properties(self, props): ...
-
-class IndexSpec(object):
+ def build(self):
+ ...
+
+ def with_all_edge_metadata(self):
+ ...
+
+ def with_all_edge_properties(self):
+ ...
+
+ def with_all_edge_properties_and_metadata(self):
+ ...
+
+ def with_all_node_metadata(self):
+ ...
+
+ def with_all_node_properties(self):
+ ...
+
+ def with_all_node_properties_and_metadata(self):
+ ...
+
+ def with_edge_metadata(self, props):
+ ...
+
+ def with_edge_properties(self, props):
+ ...
+
+ def with_node_metadata(self, props):
+ ...
+
+ def with_node_properties(self, props):
+ ...
+
+class IndexSpec(object):
+
def __repr__(self):
"""Return repr(self)."""
@property
- def edge_metadata(self): ...
+ def edge_metadata(self):
+ ...
+
@property
- def edge_properties(self): ...
+ def edge_properties(self):
+ ...
+
@property
- def node_metadata(self): ...
+ def node_metadata(self):
+ ...
+
@property
- def node_properties(self): ...
+ def node_properties(self):
+ ...
diff --git a/python/python/raphtory/algorithms/__init__.pyi b/python/python/raphtory/algorithms/__init__.pyi
index 3873e9b001..ef2c8699ea 100644
--- a/python/python/raphtory/algorithms/__init__.pyi
+++ b/python/python/raphtory/algorithms/__init__.pyi
@@ -1,7 +1,6 @@
"""
Algorithmic functions that can be run on Raphtory graphs
"""
-
from __future__ import annotations
###############################################################################
@@ -26,59 +25,8 @@ from os import PathLike
import networkx as nx # type: ignore
import pyvis # type: ignore
-__all__ = [
- "dijkstra_single_source_shortest_paths",
- "global_reciprocity",
- "betweenness_centrality",
- "all_local_reciprocity",
- "triplet_count",
- "local_triangle_count",
- "average_degree",
- "directed_graph_density",
- "degree_centrality",
- "max_degree",
- "min_degree",
- "max_out_degree",
- "max_in_degree",
- "min_out_degree",
- "min_in_degree",
- "pagerank",
- "single_source_shortest_path",
- "global_clustering_coefficient",
- "temporally_reachable_nodes",
- "temporal_bipartite_graph_projection",
- "local_clustering_coefficient",
- "local_clustering_coefficient_batch",
- "weakly_connected_components",
- "strongly_connected_components",
- "in_components",
- "in_component",
- "out_components",
- "out_component",
- "fast_rp",
- "global_temporal_three_node_motif",
- "global_temporal_three_node_motif_multi",
- "local_temporal_three_node_motifs",
- "hits",
- "balance",
- "label_propagation",
- "k_core",
- "temporal_SEIR",
- "louvain",
- "fruchterman_reingold",
- "cohesive_fruchterman_reingold",
- "max_weight_matching",
- "Matching",
- "Infected",
-]
-
-def dijkstra_single_source_shortest_paths(
- graph: GraphView,
- source: NodeInput,
- targets: list[NodeInput],
- direction: Direction = "both",
- weight: str = "weight",
-) -> NodeStateWeightedSP:
+__all__ = ['dijkstra_single_source_shortest_paths', 'global_reciprocity', 'betweenness_centrality', 'all_local_reciprocity', 'triplet_count', 'local_triangle_count', 'average_degree', 'directed_graph_density', 'degree_centrality', 'max_degree', 'min_degree', 'max_out_degree', 'max_in_degree', 'min_out_degree', 'min_in_degree', 'pagerank', 'single_source_shortest_path', 'global_clustering_coefficient', 'temporally_reachable_nodes', 'temporal_bipartite_graph_projection', 'local_clustering_coefficient', 'local_clustering_coefficient_batch', 'weakly_connected_components', 'strongly_connected_components', 'in_components', 'in_component', 'out_components', 'out_component', 'fast_rp', 'global_temporal_three_node_motif', 'global_temporal_three_node_motif_multi', 'local_temporal_three_node_motifs', 'hits', 'balance', 'label_propagation', 'k_core', 'temporal_SEIR', 'louvain', 'fruchterman_reingold', 'cohesive_fruchterman_reingold', 'max_weight_matching', 'Matching', 'Infected']
+def dijkstra_single_source_shortest_paths(graph: GraphView, source: NodeInput, targets: list[NodeInput], direction: Direction = "both", weight: str = 'weight') -> NodeStateWeightedSP:
"""
Finds the shortest paths from a single source to multiple targets in a graph.
@@ -108,9 +56,7 @@ def global_reciprocity(graph: GraphView) -> float:
float: reciprocity of the graph between 0 and 1.
"""
-def betweenness_centrality(
- graph: GraphView, k: Optional[int] = None, normalized: bool = True
-) -> NodeStateF64:
+def betweenness_centrality(graph: GraphView, k: Optional[int] = None, normalized: bool = True) -> NodeStateF64:
"""
Computes the betweenness centrality for nodes in a given graph.
@@ -278,13 +224,7 @@ def min_in_degree(graph: GraphView) -> int:
int: value of the smallest indegree
"""
-def pagerank(
- graph: GraphView,
- iter_count: int = 20,
- max_diff: Optional[float] = None,
- use_l2_norm: bool = True,
- damping_factor: float = 0.85,
-) -> NodeStateF64:
+def pagerank(graph: GraphView, iter_count: int = 20, max_diff: Optional[float] = None, use_l2_norm: bool = True, damping_factor: float = 0.85) -> NodeStateF64:
"""
Pagerank -- pagerank centrality value of the nodes in a graph
@@ -305,9 +245,7 @@ def pagerank(
NodeStateF64: Mapping of nodes to their pagerank value.
"""
-def single_source_shortest_path(
- graph: GraphView, source: NodeInput, cutoff: Optional[int] = None
-) -> NodeStateNodes:
+def single_source_shortest_path(graph: GraphView, source: NodeInput, cutoff: Optional[int] = None) -> NodeStateNodes:
"""
Calculates the single source shortest paths from a given source node.
@@ -338,13 +276,7 @@ def global_clustering_coefficient(graph: GraphView) -> float:
[`Triplet Count`](triplet_count)
"""
-def temporally_reachable_nodes(
- graph: GraphView,
- max_hops: int,
- start_time: int,
- seed_nodes: list[NodeInput],
- stop_nodes: Optional[list[NodeInput]] = None,
-) -> NodeStateReachability:
+def temporally_reachable_nodes(graph: GraphView, max_hops: int, start_time: int, seed_nodes: list[NodeInput], stop_nodes: Optional[list[NodeInput]] = None) -> NodeStateReachability:
"""
Temporally reachable nodes -- the nodes that are reachable by a time respecting path followed out from a set of seed nodes at a starting time.
@@ -363,9 +295,7 @@ def temporally_reachable_nodes(
NodeStateReachability: Mapping of nodes to their reachability history.
"""
-def temporal_bipartite_graph_projection(
- graph: GraphView, delta: int, pivot_type: str
-) -> Graph:
+def temporal_bipartite_graph_projection(graph: GraphView, delta: int, pivot_type: str) -> Graph:
"""
Projects a temporal bipartite graph into an undirected temporal graph over the pivot node type. Let `G` be a bipartite graph with node types `A` and `B`. Given `delta > 0`, the projection graph `G'` pivoting over type `B` nodes,
will make a connection between nodes `n1` and `n2` (of type `A`) at time `(t1 + t2)/2` if they respectively have an edge at time `t1`, `t2` with the same node of type `B` in `G`, and `|t2-t1| < delta`.
@@ -393,7 +323,9 @@ def local_clustering_coefficient(graph: GraphView, v: NodeInput) -> float:
float: the local clustering coefficient of node v in graph.
"""
-def local_clustering_coefficient_batch(graph, v): ...
+def local_clustering_coefficient_batch(graph, v):
+ ...
+
def weakly_connected_components(graph: GraphView) -> NodeStateUsize:
"""
Weakly connected components -- partitions the graph into node sets which are mutually reachable by an undirected path
@@ -465,14 +397,7 @@ def out_component(node: Node) -> NodeStateUsize:
NodeStateUsize: A NodeState mapping the nodes in the out-component to their distance from the starting node.
"""
-def fast_rp(
- graph: GraphView,
- embedding_dim: int,
- normalization_strength: float,
- iter_weights: list[float],
- seed: Optional[int] = None,
- threads: Optional[int] = None,
-) -> NodeStateListF64:
+def fast_rp(graph: GraphView, embedding_dim: int, normalization_strength: float, iter_weights: list[float], seed: Optional[int] = None, threads: Optional[int] = None) -> NodeStateListF64:
"""
Computes embedding vectors for each vertex of an undirected/bidirectional graph according to the Fast RP algorithm.
Original Paper: https://doi.org/10.48550/arXiv.1908.11512
@@ -488,9 +413,7 @@ def fast_rp(
NodeStateListF64: Mapping from nodes to embedding vectors.
"""
-def global_temporal_three_node_motif(
- graph: GraphView, delta: int, threads: Optional[int] = None
-) -> list[int]:
+def global_temporal_three_node_motif(graph: GraphView, delta: int, threads: Optional[int] = None) -> list[int]:
"""
Computes the number of three edge, up-to-three node delta-temporal motifs in the graph, using the algorithm of Paranjape et al, Motifs in Temporal Networks (2017).
We point the reader to this reference for more information on the algorithm and background, but provide a short summary below.
@@ -539,9 +462,7 @@ def global_temporal_three_node_motif(
"""
-def global_temporal_three_node_motif_multi(
- graph: GraphView, deltas: list[int], threads: Optional[int] = None
-) -> list[list[int]]:
+def global_temporal_three_node_motif_multi(graph: GraphView, deltas: list[int], threads: Optional[int] = None) -> list[list[int]]:
"""
Computes the global counts of three-edge up-to-three node temporal motifs for a range of timescales. See `global_temporal_three_node_motif` for an interpretation of each row returned.
@@ -554,9 +475,7 @@ def global_temporal_three_node_motif_multi(
list[list[int]]: A list of 40d arrays, each array is the motif count for a particular value of delta, returned in the order that the deltas were given as input.
"""
-def local_temporal_three_node_motifs(
- graph: GraphView, delta: int, threads=None
-) -> NodeStateMotifs:
+def local_temporal_three_node_motifs(graph: GraphView, delta: int, threads=None) -> NodeStateMotifs:
"""
Computes the number of each type of motif that each node participates in. See global_temporal_three_node_motifs for a summary of the motifs involved.
@@ -572,9 +491,7 @@ def local_temporal_three_node_motifs(
the motif. For two node motifs, both constituent nodes count the motif. For triangles, all three constituent nodes count the motif.
"""
-def hits(
- graph: GraphView, iter_count: int = 20, threads: Optional[int] = None
-) -> NodeStateHits:
+def hits(graph: GraphView, iter_count: int = 20, threads: Optional[int] = None) -> NodeStateHits:
"""
HITS (Hubs and Authority) Algorithm:
@@ -593,9 +510,7 @@ def hits(
NodeStateHits: A mapping from nodes their hub and authority scores
"""
-def balance(
- graph: GraphView, name: str = "weight", direction: Direction = "both"
-) -> NodeStateF64:
+def balance(graph: GraphView, name: str = "weight", direction: Direction = "both") -> NodeStateF64:
"""
Sums the weights of edges in the graph based on the specified direction.
@@ -614,9 +529,7 @@ def balance(
"""
-def label_propagation(
- graph: GraphView, seed: Optional[bytes] = None
-) -> list[set[Node]]:
+def label_propagation(graph: GraphView, seed: Optional[bytes] = None) -> list[set[Node]]:
"""
Computes components using a label propagation algorithm
@@ -629,9 +542,7 @@ def label_propagation(
"""
-def k_core(
- graph: GraphView, k: int, iter_count: int, threads: Optional[int] = None
-) -> list[Node]:
+def k_core(graph: GraphView, k: int, iter_count: int, threads: Optional[int] = None) -> list[Node]:
"""
Determines which nodes are in the k-core for a given value of k
@@ -646,15 +557,7 @@ def k_core(
"""
-def temporal_SEIR(
- graph: GraphView,
- seeds: int | float | list[NodeInput],
- infection_prob: float,
- initial_infection: int | str | datetime,
- recovery_rate: float | None = None,
- incubation_rate: float | None = None,
- rng_seed: int | None = None,
-) -> NodeStateSEIR:
+def temporal_SEIR(graph: GraphView, seeds: int | float | list[NodeInput], infection_prob: float, initial_infection: int | str | datetime, recovery_rate: float | None = None, incubation_rate: float | None = None, rng_seed: int | None = None) -> NodeStateSEIR:
"""
Simulate an SEIR dynamic on the network
@@ -684,12 +587,7 @@ def temporal_SEIR(
"""
-def louvain(
- graph: GraphView,
- resolution: float = 1.0,
- weight_prop: str | None = None,
- tol: None | float = None,
-) -> NodeStateUsize:
+def louvain(graph: GraphView, resolution: float = 1.0, weight_prop: str | None = None, tol: None | float = None) -> NodeStateUsize:
"""
Louvain algorithm for community detection
@@ -703,14 +601,7 @@ def louvain(
NodeStateUsize: Mapping of nodes to their community assignment
"""
-def fruchterman_reingold(
- graph: GraphView,
- iterations: int | None = 100,
- scale: float | None = 1.0,
- node_start_size: float | None = 1.0,
- cooloff_factor: float | None = 0.95,
- dt: float | None = 0.1,
-) -> NodeLayout:
+def fruchterman_reingold(graph: GraphView, iterations: int | None = 100, scale: float | None = 1.0, node_start_size: float | None = 1.0, cooloff_factor: float | None = 0.95, dt: float | None = 0.1) -> NodeLayout:
"""
Fruchterman Reingold layout algorithm
@@ -726,14 +617,7 @@ def fruchterman_reingold(
NodeLayout: A mapping from nodes to their [x, y] positions
"""
-def cohesive_fruchterman_reingold(
- graph: GraphView,
- iter_count: int = 100,
- scale: float = 1.0,
- node_start_size: float = 1.0,
- cooloff_factor: float = 0.95,
- dt: float = 0.1,
-) -> NodeLayout:
+def cohesive_fruchterman_reingold(graph: GraphView, iter_count: int = 100, scale: float = 1.0, node_start_size: float = 1.0, cooloff_factor: float = 0.95, dt: float = 0.1) -> NodeLayout:
"""
Cohesive version of `fruchterman_reingold` that adds virtual edges between isolated nodes
Arguments:
@@ -749,12 +633,7 @@ def cohesive_fruchterman_reingold(
"""
-def max_weight_matching(
- graph: GraphView,
- weight_prop: Optional[str] = None,
- max_cardinality: bool = True,
- verify_optimum_flag: bool = False,
-) -> Matching:
+def max_weight_matching(graph: GraphView, weight_prop: Optional[str] = None, max_cardinality: bool = True, verify_optimum_flag: bool = False) -> Matching:
"""
Compute a maximum-weighted matching in the general undirected weighted
graph given by "edges". If `max_cardinality` is true, only
@@ -791,7 +670,7 @@ def max_weight_matching(
Matching: The matching
"""
-class Matching(object):
+class Matching(object):
"""A Matching (i.e., a set of edges that do not share any nodes)"""
def __bool__(self):
@@ -863,7 +742,8 @@ class Matching(object):
"""
-class Infected(object):
+class Infected(object):
+
def __repr__(self):
"""Return repr(self)."""
diff --git a/python/python/raphtory/filter/__init__.pyi b/python/python/raphtory/filter/__init__.pyi
index c2e954e827..29d21e5b19 100644
--- a/python/python/raphtory/filter/__init__.pyi
+++ b/python/python/raphtory/filter/__init__.pyi
@@ -22,20 +22,9 @@ from os import PathLike
import networkx as nx # type: ignore
import pyvis # type: ignore
-__all__ = [
- "FilterExpr",
- "PropertyFilterOps",
- "NodeFilterBuilder",
- "Node",
- "EdgeFilterOp",
- "EdgeEndpoint",
- "Edge",
- "Property",
- "Metadata",
- "TemporalPropertyFilterBuilder",
-]
-
-class FilterExpr(object):
+__all__ = ['FilterExpr', 'PropertyFilterOps', 'NodeFilterBuilder', 'Node', 'EdgeFilterOp', 'EdgeEndpoint', 'Edge', 'Property', 'Metadata', 'TemporalPropertyFilterBuilder']
+class FilterExpr(object):
+
def __and__(self, value):
"""Return self&value."""
@@ -51,7 +40,8 @@ class FilterExpr(object):
def __ror__(self, value):
"""Return value|self."""
-class PropertyFilterOps(object):
+class PropertyFilterOps(object):
+
def __eq__(self, value):
"""Return self==value."""
@@ -70,15 +60,28 @@ class PropertyFilterOps(object):
def __ne__(self, value):
"""Return self!=value."""
- def contains(self, value): ...
- def fuzzy_search(self, prop_value, levenshtein_distance, prefix_match): ...
- def is_in(self, values): ...
- def is_none(self): ...
- def is_not_in(self, values): ...
- def is_some(self): ...
- def not_contains(self, value): ...
+ def contains(self, value):
+ ...
+
+ def fuzzy_search(self, prop_value, levenshtein_distance, prefix_match):
+ ...
+
+ def is_in(self, values):
+ ...
+
+ def is_none(self):
+ ...
+
+ def is_not_in(self, values):
+ ...
-class NodeFilterBuilder(object):
+ def is_some(self):
+ ...
+
+ def not_contains(self, value):
+ ...
+
+class NodeFilterBuilder(object):
"""
A builder for constructing node filters
@@ -103,13 +106,23 @@ class NodeFilterBuilder(object):
def __ne__(self, value):
"""Return self!=value."""
- def contains(self, value): ...
- def fuzzy_search(self, value, levenshtein_distance, prefix_match): ...
- def is_in(self, values): ...
- def is_not_in(self, values): ...
- def not_contains(self, value): ...
+ def contains(self, value):
+ ...
+
+ def fuzzy_search(self, value, levenshtein_distance, prefix_match):
+ ...
+
+ def is_in(self, values):
+ ...
+
+ def is_not_in(self, values):
+ ...
+
+ def not_contains(self, value):
+ ...
+
+class Node(object):
-class Node(object):
@staticmethod
def name():
"""
@@ -128,7 +141,8 @@ class Node(object):
NodeFilterBuilder: A filter builder for filtering by node type
"""
-class EdgeFilterOp(object):
+class EdgeFilterOp(object):
+
def __eq__(self, value):
"""Return self==value."""
@@ -147,22 +161,37 @@ class EdgeFilterOp(object):
def __ne__(self, value):
"""Return self!=value."""
- def contains(self, value): ...
- def fuzzy_search(self, value, levenshtein_distance, prefix_match): ...
- def is_in(self, values): ...
- def is_not_in(self, values): ...
- def not_contains(self, value): ...
+ def contains(self, value):
+ ...
+
+ def fuzzy_search(self, value, levenshtein_distance, prefix_match):
+ ...
+
+ def is_in(self, values):
+ ...
+
+ def is_not_in(self, values):
+ ...
+
+ def not_contains(self, value):
+ ...
-class EdgeEndpoint(object):
- def name(self): ...
+class EdgeEndpoint(object):
+
+ def name(self):
+ ...
+
+class Edge(object):
-class Edge(object):
@staticmethod
- def dst(): ...
+ def dst():
+ ...
+
@staticmethod
- def src(): ...
+ def src():
+ ...
-class Property(PropertyFilterOps):
+class Property(PropertyFilterOps):
"""
Construct a property filter
@@ -173,9 +202,10 @@ class Property(PropertyFilterOps):
def __new__(cls, name: str) -> Property:
"""Create and return a new object. See help(type) for accurate signature."""
- def temporal(self): ...
+ def temporal(self):
+ ...
-class Metadata(PropertyFilterOps):
+class Metadata(PropertyFilterOps):
"""
Construct a metadata filter
@@ -186,6 +216,10 @@ class Metadata(PropertyFilterOps):
def __new__(cls, name: str) -> Metadata:
"""Create and return a new object. See help(type) for accurate signature."""
-class TemporalPropertyFilterBuilder(object):
- def any(self): ...
- def latest(self): ...
+class TemporalPropertyFilterBuilder(object):
+
+ def any(self):
+ ...
+
+ def latest(self):
+ ...
diff --git a/python/python/raphtory/graph_gen/__init__.pyi b/python/python/raphtory/graph_gen/__init__.pyi
index ee2c620e70..777d89e750 100644
--- a/python/python/raphtory/graph_gen/__init__.pyi
+++ b/python/python/raphtory/graph_gen/__init__.pyi
@@ -1,7 +1,6 @@
"""
Generate Raphtory graphs from attachment models
"""
-
from __future__ import annotations
###############################################################################
@@ -27,8 +26,7 @@ from os import PathLike
import networkx as nx # type: ignore
import pyvis # type: ignore
-__all__ = ["random_attachment", "ba_preferential_attachment"]
-
+__all__ = ['random_attachment', 'ba_preferential_attachment']
def random_attachment(g: Any, nodes_to_add: Any, edges_per_step: Any, seed: Any = None):
"""
Generates a graph using the random attachment model
@@ -47,9 +45,7 @@ def random_attachment(g: Any, nodes_to_add: Any, edges_per_step: Any, seed: Any
None
"""
-def ba_preferential_attachment(
- g: Any, nodes_to_add: Any, edges_per_step: Any, seed: Any = None
-):
+def ba_preferential_attachment(g: Any, nodes_to_add: Any, edges_per_step: Any, seed: Any = None):
"""
Generates a graph using the preferential attachment model.
diff --git a/python/python/raphtory/graph_loader/__init__.pyi b/python/python/raphtory/graph_loader/__init__.pyi
index ec67c82a1e..b3ca911330 100644
--- a/python/python/raphtory/graph_loader/__init__.pyi
+++ b/python/python/raphtory/graph_loader/__init__.pyi
@@ -1,7 +1,6 @@
"""
Load and save Raphtory graphs from/to file(s)
"""
-
from __future__ import annotations
###############################################################################
@@ -27,16 +26,7 @@ from os import PathLike
import networkx as nx # type: ignore
import pyvis # type: ignore
-__all__ = [
- "lotr_graph",
- "lotr_graph_with_props",
- "neo4j_movie_graph",
- "stable_coin_graph",
- "reddit_hyperlink_graph",
- "reddit_hyperlink_graph_local",
- "karate_club_graph",
-]
-
+__all__ = ['lotr_graph', 'lotr_graph_with_props', 'neo4j_movie_graph', 'stable_coin_graph', 'reddit_hyperlink_graph', 'reddit_hyperlink_graph_local', 'karate_club_graph']
def lotr_graph() -> Graph:
"""
Load the Lord of the Rings dataset into a graph.
@@ -60,8 +50,12 @@ def lotr_graph() -> Graph:
def lotr_graph_with_props():
"""Same as `lotr_graph()` but with additional properties race and gender for some of the nodes"""
-def neo4j_movie_graph(uri, username, password, database=...): ...
-def stable_coin_graph(path=None, subset=None): ...
+def neo4j_movie_graph(uri, username, password, database=...):
+ ...
+
+def stable_coin_graph(path=None, subset=None):
+ ...
+
def reddit_hyperlink_graph(timeout_seconds: int = 600) -> Graph:
"""
Load (a subset of) Reddit hyperlinks dataset into a graph.
@@ -100,7 +94,9 @@ def reddit_hyperlink_graph(timeout_seconds: int = 600) -> Graph:
Graph: A Graph containing the Reddit hyperlinks dataset
"""
-def reddit_hyperlink_graph_local(file_path): ...
+def reddit_hyperlink_graph_local(file_path):
+ ...
+
def karate_club_graph():
"""
`karate_club_graph` constructs a karate club graph.
diff --git a/python/python/raphtory/graphql/__init__.pyi b/python/python/raphtory/graphql/__init__.pyi
index 7a0052e49f..b9b64a2215 100644
--- a/python/python/raphtory/graphql/__init__.pyi
+++ b/python/python/raphtory/graphql/__init__.pyi
@@ -22,26 +22,8 @@ from os import PathLike
import networkx as nx # type: ignore
import pyvis # type: ignore
-__all__ = [
- "GraphServer",
- "RunningGraphServer",
- "RaphtoryClient",
- "RemoteGraph",
- "RemoteEdge",
- "RemoteNode",
- "RemoteNodeAddition",
- "RemoteUpdate",
- "RemoteEdgeAddition",
- "RemoteIndexSpec",
- "PropsInput",
- "SomePropertySpec",
- "AllPropertySpec",
- "encode_graph",
- "decode_graph",
- "schema",
-]
-
-class GraphServer(object):
+__all__ = ['GraphServer', 'RunningGraphServer', 'RaphtoryClient', 'RemoteGraph', 'RemoteEdge', 'RemoteNode', 'RemoteNodeAddition', 'RemoteUpdate', 'RemoteEdgeAddition', 'RemoteIndexSpec', 'PropsInput', 'SomePropertySpec', 'AllPropertySpec', 'encode_graph', 'decode_graph', 'schema']
+class GraphServer(object):
"""
A class for defining and running a Raphtory GraphQL server
@@ -57,21 +39,7 @@ class GraphServer(object):
config_path (str | PathLike, optional): Path to the config file
"""
- def __new__(
- cls,
- work_dir: str | PathLike,
- cache_capacity: Optional[int] = None,
- cache_tti_seconds: Optional[int] = None,
- log_level: Optional[str] = None,
- tracing: Optional[bool] = None,
- otlp_agent_host: Optional[str] = None,
- otlp_agent_port: Optional[str] = None,
- otlp_tracing_service_name: Optional[str] = None,
- auth_public_key=None,
- auth_enabled_for_reads=None,
- config_path: Optional[str | PathLike] = None,
- create_index=None,
- ) -> GraphServer:
+ def __new__(cls, work_dir: str | PathLike, cache_capacity: Optional[int] = None, cache_tti_seconds: Optional[int] = None, log_level: Optional[str] = None, tracing: Optional[bool] = None, otlp_agent_host: Optional[str] = None, otlp_agent_port: Optional[str] = None, otlp_tracing_service_name: Optional[str] = None, auth_public_key=None, auth_enabled_for_reads=None, config_path: Optional[str | PathLike] = None, create_index=None) -> GraphServer:
"""Create and return a new object. See help(type) for accurate signature."""
def run(self, port: int = 1736, timeout_ms: int = 180000) -> None:
@@ -86,13 +54,7 @@ class GraphServer(object):
None:
"""
- def set_embeddings(
- self,
- cache: str,
- embedding: Optional[Callable] = None,
- nodes: bool | str = True,
- edges: bool | str = True,
- ) -> GraphServer:
+ def set_embeddings(self, cache: str, embedding: Optional[Callable] = None, nodes: bool | str = True, edges: bool | str = True) -> GraphServer:
"""
Setup the server to vectorise graphs with a default template.
@@ -127,9 +89,7 @@ class GraphServer(object):
GraphServer: The server with indexing disabled
"""
- def with_vectorised_graphs(
- self, graph_names: list[str], nodes: bool | str = True, edges: bool | str = True
- ) -> GraphServer:
+ def with_vectorised_graphs(self, graph_names: list[str], nodes: bool | str = True, edges: bool | str = True) -> GraphServer:
"""
Vectorise a subset of the graphs of the server.
@@ -142,11 +102,15 @@ class GraphServer(object):
GraphServer: A new server object containing the vectorised graphs.
"""
-class RunningGraphServer(object):
+class RunningGraphServer(object):
"""A Raphtory server handler that also enables querying the server"""
- def __enter__(self): ...
- def __exit__(self, _exc_type, _exc_val, _exc_tb): ...
+ def __enter__(self):
+ ...
+
+ def __exit__(self, _exc_type, _exc_val, _exc_tb):
+ ...
+
def get_client(self) -> RaphtoryClient:
"""
Get the client for the server
@@ -163,7 +127,7 @@ class RunningGraphServer(object):
None:
"""
-class RaphtoryClient(object):
+class RaphtoryClient(object):
"""
A client for handling GraphQL operations in the context of Raphtory.
@@ -186,9 +150,7 @@ class RaphtoryClient(object):
None:
"""
- def create_index(
- self, path: str, index_spec: RemoteIndexSpec, in_ram: bool = True
- ) -> None:
+ def create_index(self, path: str, index_spec: RemoteIndexSpec, in_ram: bool = True) -> None:
"""
Create Index for graph on the server at 'path'
@@ -246,9 +208,7 @@ class RaphtoryClient(object):
"""
- def query(
- self, query: str, variables: Optional[dict[str, Any]] = None
- ) -> dict[str, Any]:
+ def query(self, query: str, variables: Optional[dict[str, Any]] = None) -> dict[str, Any]:
"""
Make a GraphQL query against the server.
@@ -286,9 +246,7 @@ class RaphtoryClient(object):
"""
- def send_graph(
- self, path: str, graph: Graph | PersistentGraph, overwrite: bool = False
- ) -> dict[str, Any]:
+ def send_graph(self, path: str, graph: Graph | PersistentGraph, overwrite: bool = False) -> dict[str, Any]:
"""
Send a graph to the server
@@ -301,9 +259,7 @@ class RaphtoryClient(object):
dict[str, Any]: The `data` field from the graphQL response after executing the mutation.
"""
- def upload_graph(
- self, path: str, file_path: str, overwrite: bool = False
- ) -> dict[str, Any]:
+ def upload_graph(self, path: str, file_path: str, overwrite: bool = False) -> dict[str, Any]:
"""
Upload graph file from a path `file_path` on the client
@@ -316,15 +272,9 @@ class RaphtoryClient(object):
dict[str, Any]: The `data` field from the graphQL response after executing the mutation.
"""
-class RemoteGraph(object):
- def add_edge(
- self,
- timestamp: int | str | datetime,
- src: str | int,
- dst: str | int,
- properties: Optional[dict] = None,
- layer: Optional[str] = None,
- ) -> RemoteEdge:
+class RemoteGraph(object):
+
+ def add_edge(self, timestamp: int | str | datetime, src: str | int, dst: str | int, properties: Optional[dict] = None, layer: Optional[str] = None) -> RemoteEdge:
"""
Adds a new edge with the given source and destination nodes and properties to the remote graph.
@@ -361,13 +311,7 @@ class RemoteGraph(object):
None:
"""
- def add_node(
- self,
- timestamp: int | str | datetime,
- id: str | int,
- properties: Optional[dict] = None,
- node_type: Optional[str] = None,
- ) -> RemoteNode:
+ def add_node(self, timestamp: int | str | datetime, id: str | int, properties: Optional[dict] = None, node_type: Optional[str] = None) -> RemoteNode:
"""
Adds a new node with the given id and properties to the remote graph.
@@ -403,13 +347,7 @@ class RemoteGraph(object):
None:
"""
- def create_node(
- self,
- timestamp: int | str | datetime,
- id: str | int,
- properties: Optional[dict] = None,
- node_type: Optional[str] = None,
- ) -> RemoteNode:
+ def create_node(self, timestamp: int | str | datetime, id: str | int, properties: Optional[dict] = None, node_type: Optional[str] = None) -> RemoteNode:
"""
Create a new node with the given id and properties to the remote graph and fail if the node already exists.
@@ -422,13 +360,7 @@ class RemoteGraph(object):
RemoteNode: the new remote node
"""
- def delete_edge(
- self,
- timestamp: int,
- src: str | int,
- dst: str | int,
- layer: Optional[str] = None,
- ) -> RemoteEdge:
+ def delete_edge(self, timestamp: int, src: str | int, dst: str | int, layer: Optional[str] = None) -> RemoteEdge:
"""
Deletes an edge in the remote graph, given the timestamp, src and dst nodes and layer (optional)
@@ -476,7 +408,7 @@ class RemoteGraph(object):
None:
"""
-class RemoteEdge(object):
+class RemoteEdge(object):
"""
A remote edge reference
@@ -485,9 +417,7 @@ class RemoteEdge(object):
and [RemoteGraph.delete_edge][raphtory.graphql.RemoteGraph.delete_edge].
"""
- def add_metadata(
- self, properties: dict[str, PropValue], layer: Optional[str] = None
- ) -> None:
+ def add_metadata(self, properties: dict[str, PropValue], layer: Optional[str] = None) -> None:
"""
Add metadata to the edge within the remote graph.
This function is used to add metadata to an edge that does not
@@ -501,12 +431,7 @@ class RemoteEdge(object):
None:
"""
- def add_updates(
- self,
- t: int | str | datetime,
- properties: Optional[dict[str, PropValue]] = None,
- layer: Optional[str] = None,
- ) -> None:
+ def add_updates(self, t: int | str | datetime, properties: Optional[dict[str, PropValue]] = None, layer: Optional[str] = None) -> None:
"""
Add updates to an edge in the remote graph at a specified time.
@@ -534,9 +459,7 @@ class RemoteEdge(object):
None:
"""
- def update_metadata(
- self, properties: dict[str, PropValue], layer: Optional[str] = None
- ) -> None:
+ def update_metadata(self, properties: dict[str, PropValue], layer: Optional[str] = None) -> None:
"""
Update metadata of an edge in the remote graph overwriting existing values.
This function is used to add properties to an edge that does not
@@ -550,7 +473,8 @@ class RemoteEdge(object):
None:
"""
-class RemoteNode(object):
+class RemoteNode(object):
+
def add_metadata(self, properties: dict[str, PropValue]) -> None:
"""
Add metadata to a node in the remote graph.
@@ -564,9 +488,7 @@ class RemoteNode(object):
None:
"""
- def add_updates(
- self, t: int | str | datetime, properties: Optional[dict[str, PropValue]] = None
- ) -> None:
+ def add_updates(self, t: int | str | datetime, properties: Optional[dict[str, PropValue]] = None) -> None:
"""
Add updates to a node in the remote graph at a specified time.
This function allows for the addition of property updates to a node within the graph. The updates are time-stamped, meaning they are applied at the specified time.
@@ -604,7 +526,7 @@ class RemoteNode(object):
None:
"""
-class RemoteNodeAddition(object):
+class RemoteNodeAddition(object):
"""
Node addition update
@@ -615,16 +537,10 @@ class RemoteNodeAddition(object):
updates (list[RemoteUpdate], optional): the temporal updates
"""
- def __new__(
- cls,
- name: GID,
- node_type: Optional[str] = None,
- metadata: Optional[PropInput] = None,
- updates: Optional[list[RemoteUpdate]] = None,
- ) -> RemoteNodeAddition:
+ def __new__(cls, name: GID, node_type: Optional[str] = None, metadata: Optional[PropInput] = None, updates: Optional[list[RemoteUpdate]] = None) -> RemoteNodeAddition:
"""Create and return a new object. See help(type) for accurate signature."""
-class RemoteUpdate(object):
+class RemoteUpdate(object):
"""
A temporal update
@@ -633,12 +549,10 @@ class RemoteUpdate(object):
properties (PropInput, optional): the properties for the update
"""
- def __new__(
- cls, time: TimeInput, properties: Optional[PropInput] = None
- ) -> RemoteUpdate:
+ def __new__(cls, time: TimeInput, properties: Optional[PropInput] = None) -> RemoteUpdate:
"""Create and return a new object. See help(type) for accurate signature."""
-class RemoteEdgeAddition(object):
+class RemoteEdgeAddition(object):
"""
An edge update
@@ -650,17 +564,10 @@ class RemoteEdgeAddition(object):
updates (list[RemoteUpdate], optional): the temporal updates for the edge
"""
- def __new__(
- cls,
- src: GID,
- dst: GID,
- layer: Optional[str] = None,
- metadata: Optional[PropInput] = None,
- updates: Optional[list[RemoteUpdate]] = None,
- ) -> RemoteEdgeAddition:
+ def __new__(cls, src: GID, dst: GID, layer: Optional[str] = None, metadata: Optional[PropInput] = None, updates: Optional[list[RemoteUpdate]] = None) -> RemoteEdgeAddition:
"""Create and return a new object. See help(type) for accurate signature."""
-class RemoteIndexSpec(object):
+class RemoteIndexSpec(object):
"""
Create a `RemoteIndexSpec` specifying which node and edge properties to index.
@@ -672,7 +579,7 @@ class RemoteIndexSpec(object):
def __new__(cls, node_props: PropsInput, edge_props: PropsInput) -> RemoteIndexSpec:
"""Create and return a new object. See help(type) for accurate signature."""
-class PropsInput(object):
+class PropsInput(object):
"""
Create a `PropsInput` by choosing to include all/some properties explicitly.
@@ -684,14 +591,10 @@ class PropsInput(object):
ValueError: If neither `all` and `some` are specified.
"""
- def __new__(
- cls,
- all: Optional[AllPropertySpec] = None,
- some: Optional[SomePropertySpec] = None,
- ) -> PropsInput:
+ def __new__(cls, all: Optional[AllPropertySpec] = None, some: Optional[SomePropertySpec] = None) -> PropsInput:
"""Create and return a new object. See help(type) for accurate signature."""
-class SomePropertySpec(object):
+class SomePropertySpec(object):
"""
Create a `SomePropertySpec` by explicitly listing metadata and/or temporal property names.
@@ -703,7 +606,7 @@ class SomePropertySpec(object):
def __new__(cls, metadata: list[str] = [], properties=...) -> SomePropertySpec:
"""Create and return a new object. See help(type) for accurate signature."""
-class AllPropertySpec(object):
+class AllPropertySpec(object):
"""
Specifies that **all** properties should be included when creating an index.
Use one of the predefined variants: `ALL`, `ALL_METADATA`, or `ALL_TEMPORAL`.
diff --git a/python/python/raphtory/node_state/__init__.pyi b/python/python/raphtory/node_state/__init__.pyi
index 59dd4bf84f..67d87358b6 100644
--- a/python/python/raphtory/node_state/__init__.pyi
+++ b/python/python/raphtory/node_state/__init__.pyi
@@ -22,42 +22,9 @@ from os import PathLike
import networkx as nx # type: ignore
import pyvis # type: ignore
-__all__ = [
- "NodeGroups",
- "DegreeView",
- "NodeStateUsize",
- "NodeStateU64",
- "NodeStateOptionI64",
- "IdView",
- "NodeStateGID",
- "EarliestTimeView",
- "LatestTimeView",
- "NameView",
- "NodeStateString",
- "EarliestDateTimeView",
- "LatestDateTimeView",
- "NodeStateOptionDateTime",
- "HistoryView",
- "EdgeHistoryCountView",
- "NodeStateListI64",
- "HistoryDateTimeView",
- "NodeStateOptionListDateTime",
- "NodeTypeView",
- "NodeStateOptionStr",
- "NodeStateListDateTime",
- "NodeStateWeightedSP",
- "NodeStateF64",
- "NodeStateNodes",
- "NodeStateReachability",
- "NodeStateListF64",
- "NodeStateMotifs",
- "NodeStateHits",
- "NodeStateSEIR",
- "NodeLayout",
- "NodeStateF64String",
-]
-
-class NodeGroups(object):
+__all__ = ['NodeGroups', 'DegreeView', 'NodeStateUsize', 'NodeStateU64', 'NodeStateOptionI64', 'IdView', 'NodeStateGID', 'EarliestTimeView', 'LatestTimeView', 'NameView', 'NodeStateString', 'EarliestDateTimeView', 'LatestDateTimeView', 'NodeStateOptionDateTime', 'HistoryView', 'EdgeHistoryCountView', 'NodeStateListI64', 'HistoryDateTimeView', 'NodeStateOptionListDateTime', 'NodeTypeView', 'NodeStateOptionStr', 'NodeStateListDateTime', 'NodeStateWeightedSP', 'NodeStateF64', 'NodeStateNodes', 'NodeStateReachability', 'NodeStateListF64', 'NodeStateMotifs', 'NodeStateHits', 'NodeStateSEIR', 'NodeLayout', 'NodeStateF64String']
+class NodeGroups(object):
+
def __bool__(self):
"""True if self else False"""
@@ -100,7 +67,7 @@ class NodeGroups(object):
Iterator[Tuple[Any, GraphView]]: Iterator over subgraphs with corresponding value
"""
-class DegreeView(object):
+class DegreeView(object):
"""A lazy view over node values"""
def __eq__(self, value):
@@ -589,7 +556,8 @@ class DegreeView(object):
Optional[int]:
"""
-class NodeStateUsize(object):
+class NodeStateUsize(object):
+
def __eq__(self, value):
"""Return self==value."""
@@ -780,7 +748,8 @@ class NodeStateUsize(object):
Iterator[int]: Iterator over values
"""
-class NodeStateU64(object):
+class NodeStateU64(object):
+
def __eq__(self, value):
"""Return self==value."""
@@ -963,7 +932,8 @@ class NodeStateU64(object):
Iterator[int]: Iterator over values
"""
-class NodeStateOptionI64(object):
+class NodeStateOptionI64(object):
+
def __eq__(self, value):
"""Return self==value."""
@@ -1005,9 +975,7 @@ class NodeStateOptionI64(object):
NodeStateOptionI64: The k smallest values as a node state
"""
- def get(
- self, node: NodeInput, default: Optional[Optional[int]] = None
- ) -> Optional[Optional[int]]:
+ def get(self, node: NodeInput, default: Optional[Optional[int]] = None) -> Optional[Optional[int]]:
"""
Get value for node
@@ -1140,7 +1108,7 @@ class NodeStateOptionI64(object):
Iterator[Optional[int]]: Iterator over values
"""
-class IdView(object):
+class IdView(object):
"""A lazy view over node values"""
def __eq__(self, value):
@@ -1325,7 +1293,8 @@ class IdView(object):
Iterator[GID]: Iterator over values
"""
-class NodeStateGID(object):
+class NodeStateGID(object):
+
def __eq__(self, value):
"""Return self==value."""
@@ -1492,7 +1461,7 @@ class NodeStateGID(object):
Iterator[GID]: Iterator over values
"""
-class EarliestTimeView(object):
+class EarliestTimeView(object):
"""A lazy view over node values"""
def __eq__(self, value):
@@ -1667,9 +1636,7 @@ class EarliestTimeView(object):
WindowSet: A `WindowSet` object.
"""
- def get(
- self, node: NodeInput, default: Optional[Optional[int]] = None
- ) -> Optional[Optional[int]]:
+ def get(self, node: NodeInput, default: Optional[Optional[int]] = None) -> Optional[Optional[int]]:
"""
Get value for node
@@ -1946,9 +1913,7 @@ class EarliestTimeView(object):
Iterator[Optional[int]]: Iterator over values
"""
- def window(
- self, start: TimeInput | None, end: TimeInput | None
- ) -> EarliestTimeView:
+ def window(self, start: TimeInput | None, end: TimeInput | None) -> EarliestTimeView:
"""
Create a view of the EarliestTimeView including all events between `start` (inclusive) and `end` (exclusive)
@@ -1969,7 +1934,7 @@ class EarliestTimeView(object):
Optional[int]:
"""
-class LatestTimeView(object):
+class LatestTimeView(object):
"""A lazy view over node values"""
def __eq__(self, value):
@@ -2144,9 +2109,7 @@ class LatestTimeView(object):
WindowSet: A `WindowSet` object.
"""
- def get(
- self, node: NodeInput, default: Optional[Optional[int]] = None
- ) -> Optional[Optional[int]]:
+ def get(self, node: NodeInput, default: Optional[Optional[int]] = None) -> Optional[Optional[int]]:
"""
Get value for node
@@ -2444,7 +2407,7 @@ class LatestTimeView(object):
Optional[int]:
"""
-class NameView(object):
+class NameView(object):
"""A lazy view over node values"""
def __eq__(self, value):
@@ -2637,7 +2600,8 @@ class NameView(object):
Iterator[str]: Iterator over values
"""
-class NodeStateString(object):
+class NodeStateString(object):
+
def __eq__(self, value):
"""Return self==value."""
@@ -2812,7 +2776,7 @@ class NodeStateString(object):
Iterator[str]: Iterator over values
"""
-class EarliestDateTimeView(object):
+class EarliestDateTimeView(object):
"""A lazy view over node values"""
def __eq__(self, value):
@@ -2987,9 +2951,7 @@ class EarliestDateTimeView(object):
WindowSet: A `WindowSet` object.
"""
- def get(
- self, node: NodeInput, default: Optional[Optional[datetime]] = None
- ) -> Optional[Optional[datetime]]:
+ def get(self, node: NodeInput, default: Optional[Optional[datetime]] = None) -> Optional[Optional[datetime]]:
"""
Get value for node
@@ -3266,9 +3228,7 @@ class EarliestDateTimeView(object):
Iterator[Optional[datetime]]: Iterator over values
"""
- def window(
- self, start: TimeInput | None, end: TimeInput | None
- ) -> EarliestDateTimeView:
+ def window(self, start: TimeInput | None, end: TimeInput | None) -> EarliestDateTimeView:
"""
Create a view of the EarliestDateTimeView including all events between `start` (inclusive) and `end` (exclusive)
@@ -3289,7 +3249,7 @@ class EarliestDateTimeView(object):
Optional[int]:
"""
-class LatestDateTimeView(object):
+class LatestDateTimeView(object):
"""A lazy view over node values"""
def __eq__(self, value):
@@ -3464,9 +3424,7 @@ class LatestDateTimeView(object):
WindowSet: A `WindowSet` object.
"""
- def get(
- self, node: NodeInput, default: Optional[Optional[datetime]] = None
- ) -> Optional[Optional[datetime]]:
+ def get(self, node: NodeInput, default: Optional[Optional[datetime]] = None) -> Optional[Optional[datetime]]:
"""
Get value for node
@@ -3743,9 +3701,7 @@ class LatestDateTimeView(object):
Iterator[Optional[datetime]]: Iterator over values
"""
- def window(
- self, start: TimeInput | None, end: TimeInput | None
- ) -> LatestDateTimeView:
+ def window(self, start: TimeInput | None, end: TimeInput | None) -> LatestDateTimeView:
"""
Create a view of the LatestDateTimeView including all events between `start` (inclusive) and `end` (exclusive)
@@ -3766,7 +3722,8 @@ class LatestDateTimeView(object):
Optional[int]:
"""
-class NodeStateOptionDateTime(object):
+class NodeStateOptionDateTime(object):
+
def __eq__(self, value):
"""Return self==value."""
@@ -3808,9 +3765,7 @@ class NodeStateOptionDateTime(object):
NodeStateOptionDateTime: The k smallest values as a node state
"""
- def get(
- self, node: NodeInput, default: Optional[Optional[datetime]] = None
- ) -> Optional[Optional[datetime]]:
+ def get(self, node: NodeInput, default: Optional[Optional[datetime]] = None) -> Optional[Optional[datetime]]:
"""
Get value for node
@@ -3943,7 +3898,7 @@ class NodeStateOptionDateTime(object):
Iterator[Optional[datetime]]: Iterator over values
"""
-class HistoryView(object):
+class HistoryView(object):
"""A lazy view over node values"""
def __eq__(self, value):
@@ -4118,9 +4073,7 @@ class HistoryView(object):
WindowSet: A `WindowSet` object.
"""
- def get(
- self, node: NodeInput, default: Optional[list[int]] = None
- ) -> Optional[list[int]]:
+ def get(self, node: NodeInput, default: Optional[list[int]] = None) -> Optional[list[int]]:
"""
Get value for node
@@ -4410,7 +4363,7 @@ class HistoryView(object):
Optional[int]:
"""
-class EdgeHistoryCountView(object):
+class EdgeHistoryCountView(object):
"""A lazy view over node values"""
def __eq__(self, value):
@@ -4870,9 +4823,7 @@ class EdgeHistoryCountView(object):
Iterator[int]: Iterator over values
"""
- def window(
- self, start: TimeInput | None, end: TimeInput | None
- ) -> EdgeHistoryCountView:
+ def window(self, start: TimeInput | None, end: TimeInput | None) -> EdgeHistoryCountView:
"""
Create a view of the EdgeHistoryCountView including all events between `start` (inclusive) and `end` (exclusive)
@@ -4893,7 +4844,8 @@ class EdgeHistoryCountView(object):
Optional[int]:
"""
-class NodeStateListI64(object):
+class NodeStateListI64(object):
+
def __eq__(self, value):
"""Return self==value."""
@@ -4935,9 +4887,7 @@ class NodeStateListI64(object):
NodeStateListI64: The k smallest values as a node state
"""
- def get(
- self, node: NodeInput, default: Optional[list[int]] = None
- ) -> Optional[list[int]]:
+ def get(self, node: NodeInput, default: Optional[list[int]] = None) -> Optional[list[int]]:
"""
Get value for node
@@ -5062,7 +5012,7 @@ class NodeStateListI64(object):
Iterator[list[int]]: Iterator over values
"""
-class HistoryDateTimeView(object):
+class HistoryDateTimeView(object):
"""A lazy view over node values"""
def __eq__(self, value):
@@ -5237,9 +5187,7 @@ class HistoryDateTimeView(object):
WindowSet: A `WindowSet` object.
"""
- def get(
- self, node: NodeInput, default: Optional[Optional[list[datetime]]] = None
- ) -> Optional[Optional[list[datetime]]]:
+ def get(self, node: NodeInput, default: Optional[Optional[list[datetime]]] = None) -> Optional[Optional[list[datetime]]]:
"""
Get value for node
@@ -5508,9 +5456,7 @@ class HistoryDateTimeView(object):
Iterator[Optional[list[datetime]]]: Iterator over values
"""
- def window(
- self, start: TimeInput | None, end: TimeInput | None
- ) -> HistoryDateTimeView:
+ def window(self, start: TimeInput | None, end: TimeInput | None) -> HistoryDateTimeView:
"""
Create a view of the HistoryDateTimeView including all events between `start` (inclusive) and `end` (exclusive)
@@ -5531,7 +5477,8 @@ class HistoryDateTimeView(object):
Optional[int]:
"""
-class NodeStateOptionListDateTime(object):
+class NodeStateOptionListDateTime(object):
+
def __eq__(self, value):
"""Return self==value."""
@@ -5573,9 +5520,7 @@ class NodeStateOptionListDateTime(object):
NodeStateOptionListDateTime: The k smallest values as a node state
"""
- def get(
- self, node: NodeInput, default: Optional[Optional[list[datetime]]] = None
- ) -> Optional[Optional[list[datetime]]]:
+ def get(self, node: NodeInput, default: Optional[Optional[list[datetime]]] = None) -> Optional[Optional[list[datetime]]]:
"""
Get value for node
@@ -5700,7 +5645,7 @@ class NodeStateOptionListDateTime(object):
Iterator[Optional[list[datetime]]]: Iterator over values
"""
-class NodeTypeView(object):
+class NodeTypeView(object):
"""A lazy view over node values"""
def __eq__(self, value):
@@ -5760,9 +5705,7 @@ class NodeTypeView(object):
NodeStateOptionStr: the computed `NodeState`
"""
- def get(
- self, node: NodeInput, default: Optional[Optional[str]] = None
- ) -> Optional[Optional[str]]:
+ def get(self, node: NodeInput, default: Optional[Optional[str]] = None) -> Optional[Optional[str]]:
"""
Get value for node
@@ -5895,7 +5838,8 @@ class NodeTypeView(object):
Iterator[Optional[str]]: Iterator over values
"""
-class NodeStateOptionStr(object):
+class NodeStateOptionStr(object):
+
def __eq__(self, value):
"""Return self==value."""
@@ -5937,9 +5881,7 @@ class NodeStateOptionStr(object):
NodeStateOptionStr: The k smallest values as a node state
"""
- def get(
- self, node: NodeInput, default: Optional[Optional[str]] = None
- ) -> Optional[Optional[str]]:
+ def get(self, node: NodeInput, default: Optional[Optional[str]] = None) -> Optional[Optional[str]]:
"""
Get value for node
@@ -6072,7 +6014,8 @@ class NodeStateOptionStr(object):
Iterator[Optional[str]]: Iterator over values
"""
-class NodeStateListDateTime(object):
+class NodeStateListDateTime(object):
+
def __eq__(self, value):
"""Return self==value."""
@@ -6114,9 +6057,7 @@ class NodeStateListDateTime(object):
NodeStateListDateTime: The k smallest values as a node state
"""
- def get(
- self, node: NodeInput, default: Optional[list[datetime]] = None
- ) -> Optional[list[datetime]]:
+ def get(self, node: NodeInput, default: Optional[list[datetime]] = None) -> Optional[list[datetime]]:
"""
Get value for node
@@ -6241,7 +6182,8 @@ class NodeStateListDateTime(object):
Iterator[list[datetime]]: Iterator over values
"""
-class NodeStateWeightedSP(object):
+class NodeStateWeightedSP(object):
+
def __eq__(self, value):
"""Return self==value."""
@@ -6272,9 +6214,7 @@ class NodeStateWeightedSP(object):
def __repr__(self):
"""Return repr(self)."""
- def get(
- self, node: NodeInput, default: Optional[Tuple[float, Nodes]] = None
- ) -> Optional[Tuple[float, Nodes]]:
+ def get(self, node: NodeInput, default: Optional[Tuple[float, Nodes]] = None) -> Optional[Tuple[float, Nodes]]:
"""
Get value for node
@@ -6329,7 +6269,8 @@ class NodeStateWeightedSP(object):
Iterator[Tuple[float, Nodes]]: Iterator over values
"""
-class NodeStateF64(object):
+class NodeStateF64(object):
+
def __eq__(self, value):
"""Return self==value."""
@@ -6512,7 +6453,8 @@ class NodeStateF64(object):
Iterator[float]: Iterator over values
"""
-class NodeStateNodes(object):
+class NodeStateNodes(object):
+
def __eq__(self, value):
"""Return self==value."""
@@ -6598,7 +6540,8 @@ class NodeStateNodes(object):
Iterator[Nodes]: Iterator over values
"""
-class NodeStateReachability(object):
+class NodeStateReachability(object):
+
def __eq__(self, value):
"""Return self==value."""
@@ -6629,9 +6572,7 @@ class NodeStateReachability(object):
def __repr__(self):
"""Return repr(self)."""
- def get(
- self, node: NodeInput, default: Optional[list[Tuple[int, str]]] = None
- ) -> Optional[list[Tuple[int, str]]]:
+ def get(self, node: NodeInput, default: Optional[list[Tuple[int, str]]] = None) -> Optional[list[Tuple[int, str]]]:
"""
Get value for node
@@ -6686,7 +6627,8 @@ class NodeStateReachability(object):
Iterator[list[Tuple[int, str]]]: Iterator over values
"""
-class NodeStateListF64(object):
+class NodeStateListF64(object):
+
def __eq__(self, value):
"""Return self==value."""
@@ -6717,9 +6659,7 @@ class NodeStateListF64(object):
def __repr__(self):
"""Return repr(self)."""
- def get(
- self, node: NodeInput, default: Optional[list[float]] = None
- ) -> Optional[list[float]]:
+ def get(self, node: NodeInput, default: Optional[list[float]] = None) -> Optional[list[float]]:
"""
Get value for node
@@ -6774,7 +6714,8 @@ class NodeStateListF64(object):
Iterator[list[float]]: Iterator over values
"""
-class NodeStateMotifs(object):
+class NodeStateMotifs(object):
+
def __eq__(self, value):
"""Return self==value."""
@@ -6816,9 +6757,7 @@ class NodeStateMotifs(object):
NodeStateMotifs: The k smallest values as a node state
"""
- def get(
- self, node: NodeInput, default: Optional[list[int]] = None
- ) -> Optional[list[int]]:
+ def get(self, node: NodeInput, default: Optional[list[int]] = None) -> Optional[list[int]]:
"""
Get value for node
@@ -6943,7 +6882,8 @@ class NodeStateMotifs(object):
Iterator[list[int]]: Iterator over values
"""
-class NodeStateHits(object):
+class NodeStateHits(object):
+
def __eq__(self, value):
"""Return self==value."""
@@ -6985,9 +6925,7 @@ class NodeStateHits(object):
NodeStateHits: The k smallest values as a node state
"""
- def get(
- self, node: NodeInput, default: Optional[Tuple[float, float]] = None
- ) -> Optional[Tuple[float, float]]:
+ def get(self, node: NodeInput, default: Optional[Tuple[float, float]] = None) -> Optional[Tuple[float, float]]:
"""
Get value for node
@@ -7112,7 +7050,8 @@ class NodeStateHits(object):
Iterator[Tuple[float, float]]: Iterator over values
"""
-class NodeStateSEIR(object):
+class NodeStateSEIR(object):
+
def __eq__(self, value):
"""Return self==value."""
@@ -7154,9 +7093,7 @@ class NodeStateSEIR(object):
NodeStateSEIR: The k smallest values as a node state
"""
- def get(
- self, node: NodeInput, default: Optional[Infected] = None
- ) -> Optional[Infected]:
+ def get(self, node: NodeInput, default: Optional[Infected] = None) -> Optional[Infected]:
"""
Get value for node
@@ -7281,7 +7218,8 @@ class NodeStateSEIR(object):
Iterator[Infected]: Iterator over values
"""
-class NodeLayout(object):
+class NodeLayout(object):
+
def __eq__(self, value):
"""Return self==value."""
@@ -7312,9 +7250,7 @@ class NodeLayout(object):
def __repr__(self):
"""Return repr(self)."""
- def get(
- self, node: NodeInput, default: Optional[list[float]] = None
- ) -> Optional[list[float]]:
+ def get(self, node: NodeInput, default: Optional[list[float]] = None) -> Optional[list[float]]:
"""
Get value for node
@@ -7369,7 +7305,8 @@ class NodeLayout(object):
Iterator[list[float]]: Iterator over values
"""
-class NodeStateF64String(object):
+class NodeStateF64String(object):
+
def __eq__(self, value):
"""Return self==value."""
@@ -7400,9 +7337,7 @@ class NodeStateF64String(object):
def __repr__(self):
"""Return repr(self)."""
- def get(
- self, node: NodeInput, default: Optional[Tuple[float, str]] = None
- ) -> Optional[Tuple[float, str]]:
+ def get(self, node: NodeInput, default: Optional[Tuple[float, str]] = None) -> Optional[Tuple[float, str]]:
"""
Get value for node
diff --git a/python/python/raphtory/vectors/__init__.pyi b/python/python/raphtory/vectors/__init__.pyi
index c4a2361882..1f6c6ce647 100644
--- a/python/python/raphtory/vectors/__init__.pyi
+++ b/python/python/raphtory/vectors/__init__.pyi
@@ -22,15 +22,10 @@ from os import PathLike
import networkx as nx # type: ignore
import pyvis # type: ignore
-__all__ = ["VectorisedGraph", "Document", "Embedding", "VectorSelection"]
+__all__ = ['VectorisedGraph', 'Document', 'Embedding', 'VectorSelection']
+class VectorisedGraph(object):
-class VectorisedGraph(object):
- def edges_by_similarity(
- self,
- query: str | list,
- limit: int,
- window: Optional[Tuple[int | str, int | str]] = None,
- ) -> VectorSelection:
+ def edges_by_similarity(self, query: str | list, limit: int, window: Optional[Tuple[int | str, int | str]] = None) -> VectorSelection:
"""
Search the top scoring edges according to `query` with no more than `limit` edges
@@ -46,12 +41,7 @@ class VectorisedGraph(object):
def empty_selection(self):
"""Return an empty selection of documents"""
- def entities_by_similarity(
- self,
- query: str | list,
- limit: int,
- window: Optional[Tuple[int | str, int | str]] = None,
- ) -> VectorSelection:
+ def entities_by_similarity(self, query: str | list, limit: int, window: Optional[Tuple[int | str, int | str]] = None) -> VectorSelection:
"""
Search the top scoring entities according to `query` with no more than `limit` entities
@@ -64,12 +54,7 @@ class VectorisedGraph(object):
VectorSelection: The vector selection resulting from the search
"""
- def nodes_by_similarity(
- self,
- query: str | list,
- limit: int,
- window: Optional[Tuple[int | str, int | str]] = None,
- ) -> VectorSelection:
+ def nodes_by_similarity(self, query: str | list, limit: int, window: Optional[Tuple[int | str, int | str]] = None) -> VectorSelection:
"""
Search the top scoring nodes according to `query` with no more than `limit` nodes
@@ -82,7 +67,7 @@ class VectorisedGraph(object):
VectorSelection: The vector selection resulting from the search
"""
-class Document(object):
+class Document(object):
"""
A Document
@@ -123,11 +108,13 @@ class Document(object):
Optional[Any]:
"""
-class Embedding(object):
+class Embedding(object):
+
def __repr__(self):
"""Return repr(self)."""
-class VectorSelection(object):
+class VectorSelection(object):
+
def add_edges(self, edges: list) -> None:
"""
Add all the documents associated with the `edges` to the current selection
@@ -173,9 +160,7 @@ class VectorSelection(object):
list[Edge]: list of edges in the current selection
"""
- def expand(
- self, hops: int, window: Optional[Tuple[int | str, int | str]] = None
- ) -> None:
+ def expand(self, hops: int, window: Optional[Tuple[int | str, int | str]] = None) -> None:
"""
Add all the documents `hops` hops away to the selection
@@ -192,12 +177,7 @@ class VectorSelection(object):
None:
"""
- def expand_edges_by_similarity(
- self,
- query: str | list,
- limit: int,
- window: Optional[Tuple[int | str, int | str]] = None,
- ) -> None:
+ def expand_edges_by_similarity(self, query: str | list, limit: int, window: Optional[Tuple[int | str, int | str]] = None) -> None:
"""
Add the top `limit` adjacent edges with higher score for `query` to the selection
@@ -212,12 +192,7 @@ class VectorSelection(object):
None:
"""
- def expand_entities_by_similarity(
- self,
- query: str | list,
- limit: int,
- window: Optional[Tuple[int | str, int | str]] = None,
- ) -> None:
+ def expand_entities_by_similarity(self, query: str | list, limit: int, window: Optional[Tuple[int | str, int | str]] = None) -> None:
"""
Add the top `limit` adjacent entities with higher score for `query` to the selection
@@ -239,12 +214,7 @@ class VectorSelection(object):
None:
"""
- def expand_nodes_by_similarity(
- self,
- query: str | list,
- limit: int,
- window: Optional[Tuple[int | str, int | str]] = None,
- ) -> None:
+ def expand_nodes_by_similarity(self, query: str | list, limit: int, window: Optional[Tuple[int | str, int | str]] = None) -> None:
"""
Add the top `limit` adjacent nodes with higher score for `query` to the selection
diff --git a/python/scripts/gen-stubs.py b/python/scripts/gen-stubs.py
index addb424b5e..66c187e29a 100755
--- a/python/scripts/gen-stubs.py
+++ b/python/scripts/gen-stubs.py
@@ -24,4 +24,5 @@
path = Path(__file__).parent.parent / "python"
set_imports(imports)
+ print("Creating stubs...")
gen_module(raphtory, "raphtory", path, "raphtory")
diff --git a/python/tests/test_base_install/test_graphql/test_gen_schema.py b/python/tests/test_base_install/test_graphql/test_gen_schema.py
index 9e1557c2c8..f966c29fd3 100644
--- a/python/tests/test_base_install/test_graphql/test_gen_schema.py
+++ b/python/tests/test_base_install/test_graphql/test_gen_schema.py
@@ -7,6 +7,5 @@
print(f"Creating graphql.schema file at {graphql_file_path}")
-with open(graphql_file_path, 'w', encoding='utf8') as f:
+with open(graphql_file_path, "w", encoding="utf8") as f:
f.write(schema())
-
diff --git a/raphtory-graphql/schema.graphql b/raphtory-graphql/schema.graphql
index 34f76b34c3..c4993adade 100644
--- a/raphtory-graphql/schema.graphql
+++ b/raphtory-graphql/schema.graphql
@@ -344,8 +344,8 @@ type Graph {
}
type GraphAlgorithmPlugin {
- shortest_path(source: String!, targets: [String!]!, direction: String): [ShortestPathOutput!]!
pagerank(iterCount: Int!, threads: Int, tol: Float): [PagerankOutput!]!
+ shortest_path(source: String!, targets: [String!]!, direction: String): [ShortestPathOutput!]!
}
type GraphSchema {