Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update things #106

Merged
merged 6 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/run-tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = 'en'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down
1 change: 1 addition & 0 deletions hcga/analysis.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Functions for the analysis of extracted feature matrix.
"""

import itertools
import logging
import os
Expand Down
1 change: 1 addition & 0 deletions hcga/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
Alternatively these commands can be bundled together into a single bash file,
see 'run_example.sh' in the examples folder.
"""

import logging
import os
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions hcga/dataset_creation/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""submodule to create datasets of various types"""

from .benchmark_datasets import make as make_benchmark_dataset
from .synthetic_datasets import make as make_synthetic
from .test_dataset import make as make_test_dataset
8 changes: 4 additions & 4 deletions hcga/dataset_creation/benchmark_datasets.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""make benchmark datasets"""

import os
import shutil
import zipfile
from pathlib import Path

import numpy as np
import pandas as pd
import wget

Expand Down Expand Up @@ -51,7 +51,7 @@ def extract_benchmark_graphs(datadir, dataname): # pylint: disable=too-many-loc
prefix = str(Path(datadir) / dataname)

with open(prefix + "_graph_indicator.txt") as f:
nodes_df = pd.read_csv(f, dtype=np.int, header=None) - 1
nodes_df = pd.read_csv(f, dtype=int, header=None) - 1
nodes_df.columns = ["graph_id"]

with open(prefix + "_graph_labels.txt") as f:
Expand All @@ -60,9 +60,9 @@ def extract_benchmark_graphs(datadir, dataname): # pylint: disable=too-many-loc
edges_df = pd.DataFrame()
with open(prefix + "_A.txt") as f:
for edges_df_next in pd.read_csv(
f, sep=",", delimiter=None, dtype=np.int, header=None, chunksize=1e6
f, sep=",", delimiter=None, dtype=int, header=None, chunksize=1e6
):
edges_df = edges_df.append(edges_df_next - 1)
edges_df = pd.concat([edges_df, edges_df_next - 1])
edges_df.columns = ["start_node", "end_node"]
edges_df["graph_id"] = nodes_df["graph_id"][edges_df["start_node"].to_list()].to_list()

Expand Down
1 change: 1 addition & 0 deletions hcga/dataset_creation/synthetic_datasets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""make synthetic datasets: WIP!!"""

import networkx as nx
import numpy as np

Expand Down
1 change: 1 addition & 0 deletions hcga/dataset_creation/test_dataset.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""make test datasets"""

import networkx as nx
import numpy as np
import pandas as pd
Expand Down
1 change: 1 addition & 0 deletions hcga/extraction.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions necessary for the extraction of graph features."""

import logging
import time
from functools import partial
Expand Down
1 change: 1 addition & 0 deletions hcga/feature_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
The functions here are necessary to evaluate each individual feature found inside a feature class.

"""

import logging
import multiprocessing
import sys
Expand Down
1 change: 1 addition & 0 deletions hcga/features/assortativity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Assortativity class."""

from functools import partial

import networkx as nx
Expand Down
1 change: 1 addition & 0 deletions hcga/features/basal_nodes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Basal nodes class."""

from functools import lru_cache

from hcga.feature_class import FeatureClass, InterpretabilityScore
Expand Down
1 change: 1 addition & 0 deletions hcga/features/basic_stats.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Basic stats class."""

import networkx as nx
import numpy as np

Expand Down
1 change: 1 addition & 0 deletions hcga/features/centralities_basic.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Centralities class."""

import networkx as nx
import numpy as np
from networkx.algorithms import centrality
Expand Down
1 change: 1 addition & 0 deletions hcga/features/chemical_theory.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Chemical theory class."""

from functools import partial

import networkx as nx
Expand Down
5 changes: 3 additions & 2 deletions hcga/features/cliques.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Cliques class."""

from functools import lru_cache

import numpy as np
Expand Down Expand Up @@ -66,15 +67,15 @@ def compute_features(self):
# graph clique number
self.add_feature(
"graph_clique_number",
clique.graph_clique_number,
lambda graph: max(len(c) for c in clique.find_cliques(graph)),
"The clique number of a graph is the size of the largest clique in the graph",
InterpretabilityScore(3),
)

# number of maximal cliques
self.add_feature(
"num_max_cliques",
clique.graph_number_of_cliques,
lambda graph: sum(1 for _ in clique.find_cliques(graph)),
"The number of maximal cliques in the graph",
InterpretabilityScore(3),
)
Expand Down
1 change: 1 addition & 0 deletions hcga/features/clustering.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Clustering class."""

import networkx as nx
import numpy as np

Expand Down
1 change: 1 addition & 0 deletions hcga/features/communities_asyn.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Communities Asyn class."""

from collections import Counter
from functools import lru_cache, partial

Expand Down
1 change: 1 addition & 0 deletions hcga/features/communities_bisection.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Communities Bisection class."""

from functools import lru_cache

from networkx.algorithms.community import kernighan_lin_bisection
Expand Down
1 change: 1 addition & 0 deletions hcga/features/communities_labelprop.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Communities Label propagation class."""

from functools import lru_cache

from networkx.algorithms.community import label_propagation_communities
Expand Down
1 change: 1 addition & 0 deletions hcga/features/communities_modularity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Communities Modularity propagation class."""

from functools import lru_cache, partial

from networkx.algorithms.community import greedy_modularity_communities
Expand Down
1 change: 1 addition & 0 deletions hcga/features/components.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Components class."""

from functools import lru_cache

import networkx as nx
Expand Down
1 change: 1 addition & 0 deletions hcga/features/core_number.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Core number class."""

import networkx as nx
import numpy as np

Expand Down
1 change: 1 addition & 0 deletions hcga/features/covering.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Covering class."""

import networkx as nx

from hcga.feature_class import FeatureClass, InterpretabilityScore
Expand Down
1 change: 1 addition & 0 deletions hcga/features/cycle_basis.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Cycle Basis class."""

from functools import lru_cache

import networkx as nx
Expand Down
1 change: 1 addition & 0 deletions hcga/features/distance_measures.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Distance Measures class."""

import networkx as nx

from hcga.feature_class import FeatureClass, InterpretabilityScore
Expand Down
1 change: 1 addition & 0 deletions hcga/features/dominating_sets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Dominating sets class."""

import networkx as nx

from hcga.feature_class import FeatureClass, InterpretabilityScore
Expand Down
1 change: 1 addition & 0 deletions hcga/features/efficiency.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Distance Measures class."""

import networkx as nx

from hcga.feature_class import FeatureClass, InterpretabilityScore
Expand Down
1 change: 1 addition & 0 deletions hcga/features/eulerian.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Eulerian Measures class."""

import networkx as nx

from hcga.feature_class import FeatureClass, InterpretabilityScore
Expand Down
1 change: 1 addition & 0 deletions hcga/features/flow_hierarchy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Flow hierarchy class."""

from functools import partial

import networkx as nx
Expand Down
1 change: 1 addition & 0 deletions hcga/features/in_out_degrees.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""In Out degrees class."""

import networkx as nx

from hcga.feature_class import FeatureClass, InterpretabilityScore
Expand Down
1 change: 1 addition & 0 deletions hcga/features/independent_sets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Independent sets class."""

import networkx as nx

from hcga.feature_class import FeatureClass, InterpretabilityScore
Expand Down
1 change: 1 addition & 0 deletions hcga/features/jaccard_similarity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Jaccard Similarity class."""

from functools import lru_cache

import networkx as nx
Expand Down
1 change: 1 addition & 0 deletions hcga/features/k_components.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""K Components class."""

from functools import lru_cache

import networkx as nx
Expand Down
1 change: 1 addition & 0 deletions hcga/features/link_analysis_hits.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""HITS hubs class."""

import networkx as nx

from hcga.feature_class import FeatureClass, InterpretabilityScore
Expand Down
1 change: 1 addition & 0 deletions hcga/features/looplessness.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Looplessness class."""

from functools import lru_cache, partial

import networkx as nx
Expand Down
1 change: 1 addition & 0 deletions hcga/features/maximal_matching.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Maximal matching class."""

import networkx as nx

from hcga.feature_class import FeatureClass, InterpretabilityScore
Expand Down
1 change: 1 addition & 0 deletions hcga/features/minimum_cuts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Minimum cuts class."""

import networkx as nx

from hcga.feature_class import FeatureClass, InterpretabilityScore
Expand Down
1 change: 1 addition & 0 deletions hcga/features/node_clique_number.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Node clique number class."""

from networkx.algorithms import clique

from hcga.feature_class import FeatureClass, InterpretabilityScore
Expand Down
1 change: 1 addition & 0 deletions hcga/features/node_connectivity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Node connectivity class."""

import networkx as nx
import numpy as np

Expand Down
1 change: 1 addition & 0 deletions hcga/features/node_features.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Node Features class."""

from functools import lru_cache

import networkx as nx
Expand Down
1 change: 1 addition & 0 deletions hcga/features/rbc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Role-similarity Based Comparison class."""

from functools import lru_cache

import networkx as nx
Expand Down
1 change: 1 addition & 0 deletions hcga/features/reciprocity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Reciprocity class."""

import networkx as nx

from hcga.feature_class import FeatureClass, InterpretabilityScore
Expand Down
1 change: 1 addition & 0 deletions hcga/features/rich_club.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Rich Club class."""

from functools import lru_cache

import networkx as nx
Expand Down
1 change: 1 addition & 0 deletions hcga/features/scale_free.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Scale Free class."""

from functools import partial

import networkx as nx
Expand Down
1 change: 1 addition & 0 deletions hcga/features/shortest_paths.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Shortest paths class."""

from functools import lru_cache

import networkx as nx
Expand Down
1 change: 1 addition & 0 deletions hcga/features/simple_cycles.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Simple cycles class."""

from functools import lru_cache

import networkx as nx
Expand Down
1 change: 1 addition & 0 deletions hcga/features/small_worldness.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Small worldness class."""

import networkx as nx

from hcga.feature_class import FeatureClass, InterpretabilityScore
Expand Down
1 change: 1 addition & 0 deletions hcga/features/spectrum.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Spectrum class."""

from functools import lru_cache, partial

import networkx as nx
Expand Down
1 change: 1 addition & 0 deletions hcga/features/structural_holes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Structural Holes class."""

import networkx as nx

from hcga.feature_class import FeatureClass, InterpretabilityScore
Expand Down
1 change: 1 addition & 0 deletions hcga/features/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utils functions for feature classes."""

import networkx as nx


Expand Down
1 change: 1 addition & 0 deletions hcga/features/vitality.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Vitality class."""

import networkx as nx

from hcga.feature_class import FeatureClass, InterpretabilityScore
Expand Down
1 change: 1 addition & 0 deletions hcga/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
graph type into a generic hcga Graph object.

"""

import logging

import networkx as nx
Expand Down
1 change: 1 addition & 0 deletions hcga/hcga.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Object-oriented API to hcga."""

import logging

import pandas as pd
Expand Down
1 change: 1 addition & 0 deletions hcga/io.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""input/output functions."""

import os
import pickle
from pathlib import Path
Expand Down
Loading
Loading