Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
ljeub-pometry committed Jan 23, 2025
1 parent 461d3e5 commit 505bc5f
Show file tree
Hide file tree
Showing 6 changed files with 1,735 additions and 613 deletions.
138 changes: 0 additions & 138 deletions python/python/raphtory/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
###############################################################################

from typing import *
from raphtory import *
from raphtory.algorithms import *
from raphtory.vectors import *
from raphtory.node_state import *
Expand Down Expand Up @@ -6070,143 +6069,6 @@ class WindowSet(object):
Iterable: the time index"
"""

class AlgorithmResult(object):
def __len__(self):
"""Return len(self)."""

def __repr__(self):
"""Return repr(self)."""

def get(self, key: NodeInput) -> Optional[Any]:
"""
Returns the value corresponding to the provided key
Arguments:
key (NodeInput): The node for which the value is to be retrieved.
Returns:
Optional[Any]: The value for the node or `None` if the value does not exist.
"""

def get_all(self) -> dict[Node, Any]:
"""
Returns a Dict containing all the nodes (as keys) and their corresponding values (values) or none.
Returns:
dict[Node, Any]: A dict of nodes and their values
"""

def get_all_values(self) -> list[Any]:
"""
Get all values
Returns:
list[Any]: the values for each node as a list
"""

def get_all_with_names(self) -> dict[str, Any]:
"""
Returns a dict with node names and values
Returns:
dict[str, Any]: a dict with node names and values
"""

def group_by(self) -> dict[Any, list[str]]:
"""
Groups the `AlgorithmResult` by its values.
Returns:
dict[Any, list[str]]: A mapping where keys are unique values from the `AlgorithmResult` and values are lists of nodes
that share the same value.
"""

def max(self) -> Tuple[Node, Any]:
"""
Find node with maximum value
Returns:
Tuple[Node, Any]: The node and maximum value.
"""

def median(self):
"""
Returns a tuple of the median result with its key
Returns:
Optional[Tuple[Node, Any]]: The node with median value or `None` if there are no nodes.
"""

def min(self) -> Tuple[Node, Any]:
"""
Find node with minimum value
Returns:
Tuple[Node, Any]: The node and minimum value.
"""

def sort_by_node(self, reverse: bool = True) -> list[Tuple[Node, Any]]:
"""
Sorts by node id in ascending or descending order.
Arguments:
reverse (bool): If `true`, sorts the result in descending order; otherwise, sorts in ascending order. Defaults to True.
Returns:
list[Tuple[Node, Any]]: A sorted list of tuples containing nodes and values.
"""

def sort_by_node_name(self, reverse: bool = True) -> list[Tuple[Node, Any]]:
"""
The function `sort_by_node_name` sorts a vector of tuples containing a node and an optional
value by the node name in either ascending or descending order.
Arguments:
reverse (bool): A boolean value indicating whether the sorting should be done in reverse order or not. Defaults to True.
If reverse is true, the sorting will be done in descending order, otherwise it will be done in
ascending order.
Returns:
list[Tuple[Node, Any]]: The function sort_by_node_name returns a vector of tuples. Each tuple contains a Node and value
"""

def sort_by_value(self, reverse: bool = True) -> list[Tuple[Node, Any]]:
"""
Sorts the `AlgorithmResult` by its values in ascending or descending order.
Arguments:
reverse (bool): If `true`, sorts the result in descending order, otherwise, sorts in ascending order. Defaults to True.
Returns:
list[Tuple[Node, Any]]: A sorted vector of tuples containing Nodes and values.
"""

def to_df(self) -> DataFrame:
"""
Creates a dataframe from the result
Returns:
DataFrame: A `pandas.DataFrame` containing the result
"""

def top_k(
self, k: int, percentage: bool = False, reverse: bool = True
) -> list[Tuple[Node, Any]]:
"""
Retrieves the top-k elements from the `AlgorithmResult` based on its values.
Arguments:
k (int): The number of elements to retrieve.
percentage (bool): If `True`, the `k` parameter is treated as a percentage of total elements. Defaults to False.
reverse (bool): If `True`, retrieves the elements in descending order, otherwise, in ascending order. Defaults to True.
Returns:
list[Tuple[Node, Any]]: List of tuples with keys of nodes and values of type `Y`.
If percentage is true, the returned vector contains the top `k` percentage of elements.
If percentage is false, the returned vector contains the top `k` elements.
Returns None if the result is empty or if `k` is 0.
"""

class GraphIndex(object):
"""
A searchable Index for a `Graph`. This allows for fuzzy and exact searches of nodes and edges.
Expand Down
Loading

0 comments on commit 505bc5f

Please sign in to comment.