Skip to content

Commit 7296ddd

Browse files
authored
Merge pull request #114 from stephenhky/develop
Remove `nptyping`
2 parents 47d4b69 + ddeefa1 commit 7296ddd

File tree

5 files changed

+4832
-3816
lines changed

5 files changed

+4832
-3816
lines changed

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "graphflow"
7-
version = "0.7.0"
7+
version = "0.7.1"
88
authors = [
99
{name = "Kwan Yuet Stephen Ho", email = "stephenhky@yahoo.com.hk"}
1010
]
@@ -26,11 +26,12 @@ classifiers=[
2626
"Programming Language :: C",
2727
"License :: OSI Approved :: MIT License",
2828
]
29-
dependencies = ["Cython>=0.29.0", "numpy>=1.20.0", "networkx>=3.0", "sparse>=0.10.0", "nptyping"]
29+
dependencies = ["Cython>=0.29.0", "numpy>=1.20.0", "networkx>=3.0", "sparse>=0.10.0"]
3030

3131
[project.urls]
3232
Repository = "https://github.com/stephenhky/GraphFlow"
3333
Issues = "https://github.com/stephenhky/GraphFlow/issues"
34+
Documentation = "https://graphflow.readthedocs.io"
3435

3536
[tool.setuptools]
3637
packages = [

src/graphflow/hits/hitsrank.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11

22
# Jon Kleinberg's HITS (Hyperlink-Induced Topic Search) algorithm
33

4+
from typing import Literal, Annotated
5+
46
import networkx
57
import numpy as np
68
import networkx as nx
7-
from nptyping import NDArray, Shape, Float
9+
from numpy.typing import NDArray
810

911
from .. import L1norm
1012

1113

1214
def hits(
13-
adjMatrix: NDArray[Shape["*, *"], Float],
15+
adjMatrix: Annotated[NDArray[np.float64], Literal["2D Array"]],
1416
eps: float=1e-4,
1517
maxstep: int=1000
16-
) -> tuple[NDArray[Shape["*"], Float], NDArray[Shape["*"], Float]]:
18+
) -> tuple[Annotated[NDArray[np.float64], Literal["1D Array"]], Annotated[NDArray[np.float64], Literal["1D Array"]]]:
1719
"""
1820
Compute the HITS (Hyperlink-Induced Topic Search) algorithm on an adjacency matrix.
1921
@@ -64,7 +66,7 @@ def CalculateHITS(
6466
digraph: networkx.DiGraph,
6567
eps: float=1e-4,
6668
maxstep: int=1000
67-
) -> tuple[NDArray[Shape["*"], Float], NDArray[Shape["*"], Float]]:
69+
) -> tuple[Annotated[NDArray[np.float64], Literal["1D Array"]], Annotated[NDArray[np.float64], Literal["1D Array"]]]:
6870
"""
6971
Compute the HITS (Hyperlink-Induced Topic Search) algorithm on a NetworkX digraph.
7072

src/graphflow/pagerank/GooglePageRank.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

22
import warnings
3-
from typing import Tuple
3+
from typing import Annotated, Literal
44

55
import networkx
66
import numpy as np
7-
from nptyping import NDArray, Shape, Float
7+
from numpy.typing import NDArray
88

99
from .cpagerank import pagerank_cython
1010
from .. import L1norm, PageRankLanguage
@@ -13,7 +13,7 @@
1313
def GoogleMatrix(
1414
digraph: networkx.DiGraph,
1515
beta: float
16-
) -> Tuple[NDArray[Shape["*, *"], Float], dict[str, int]]:
16+
) -> tuple[Annotated[NDArray[np.float64], Literal["1D Array"]], dict[str, int]]:
1717
"""
1818
Compute the Google Matrix for a directed graph.
1919
@@ -43,7 +43,7 @@ def GoogleMatrix(
4343

4444

4545
def CalculatePageRankFromAdjacencyMatrix_Cython(
46-
adjMatrix: NDArray[Shape["*, *"], Float],
46+
adjMatrix: Annotated[NDArray[np.float64], Literal["2D Array"]],
4747
nodes: dict[str, int],
4848
eps: float=1e-4,
4949
maxstep: int=1000
@@ -52,7 +52,7 @@ def CalculatePageRankFromAdjacencyMatrix_Cython(
5252

5353

5454
def CalculatePageRankFromAdjacencyMatrix_Python(
55-
adjMatrix: NDArray[Shape["*, *"], Float],
55+
adjMatrix: Annotated[NDArray[np.float64], Literal["2D Array"]],
5656
nodes: dict[str, int],
5757
eps: float=1e-4,
5858
maxstep: int=1000
@@ -95,7 +95,7 @@ def CalculatePageRankFromAdjacencyMatrix_Python(
9595

9696

9797
def CalculatePageRankFromAdjacencyMatrix(
98-
adjMatrix: NDArray[Shape["*, *"], Float],
98+
adjMatrix: Annotated[NDArray[np.float64], Literal["2D Array"]],
9999
nodes: dict[str, int],
100100
eps: float=1e-4,
101101
maxstep: int=1000,

0 commit comments

Comments
 (0)