internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: graspologic-org/graspologic

Issue:
update requirements to scipy>=1.4
Scipy 1.4
- has much faster linear assignment problem, making FAQ way faster
- has MGC, which we eventually want for new nonpar, signal subgraph


Discussion:
I could take this one!
Btw, my real name is (Giovanni) Giorgio but everybody calls me Giorgio.(I am sure you will get the reference : ) 
@PerifanosPrometheus 
fyi, no need to bother with mgc for nonpar, cuz we now have a hyppo background ( #336 ). idk the status of subgraphs.

> Btw, my real name is (Giovanni) Giorgio but everybody calls me Giorgio.(I am sure you will get the reference : )

i did not ...

upd: figured it out me thinks. like the album, actually, but i think i heard the song like once.
Thank you very much!

@PerifanosPrometheus no need to worry about changing any code other than the requirements part
@bdpedigo I am going to update the requirement in the [setup.py](https://github.com/neurodata/graspy/blob/master/setup.py#L13-22) and in the [requirement.txt](https://github.com/neurodata/graspy/blob/master/requirements.txt). I believe that should be enough, thank you for your advice!

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -15,7 +15,7 @@
     "networkx>=2.1",
     "numpy>=1.8.1",
     "scikit-learn>=0.19.1",
-    "scipy>=1.1.0",
+    "scipy>=1.4.0",
     "seaborn>=0.9.0",
     "matplotlib>=3.0.0",
     "hyppo>=0.1.3",


Test patch:
Repository: graspologic-org/graspologic

Issue:
remove * import in simulations
https://github.com/neurodata/graspy/blob/master/graspy/simulations/__init__.py

should not be using * import here


Discussion:
I can do this one

Resolving patch:
diff --git a/graspy/simulations/__init__.py b/graspy/simulations/__init__.py
--- a/graspy/simulations/__init__.py
+++ b/graspy/simulations/__init__.py
@@ -1,6 +1,19 @@
 # Copyright (c) Microsoft Corporation and contributors.
 # Licensed under the MIT License.
 
-from .simulations import *
-from .simulations_corr import *
-from .rdpg_corr import *
+from .simulations import sample_edges, er_np, er_nm, sbm, rdpg, p_from_latent
+from .simulations_corr import sample_edges_corr, er_corr, sbm_corr
+from .rdpg_corr import rdpg_corr
+
+__all__ = [
+    "sample_edges",
+    "er_np",
+    "er_nm",
+    "sbm",
+    "rdpg",
+    "p_from_latent",
+    "sample_edges_corr",
+    "er_corr",
+    "sbm_corr",
+    "rdpg_corr",
+]


Test patch:
diff --git a/tests/test_sims.py b/tests/test_sims.py
--- a/tests/test_sims.py
+++ b/tests/test_sims.py
@@ -6,7 +6,7 @@
 import numpy as np
 import networkx as nx
 from graspy.simulations import *
-from graspy.utils.utils import is_symmetric, is_loopless
+from graspy.utils.utils import is_symmetric, is_loopless, symmetrize, cartprod
 
 
 def remove_diagonal(A):
Repository: graspologic-org/graspologic

Issue:
remove ari return value from AutoGMM.fit_predict
Doesn't match with API well, should just get rid of this


Discussion:
@asaadeldin11 necessary for #306 
I'll knock this out for sprint 0

Resolving patch:
diff --git a/graspy/cluster/base.py b/graspy/cluster/base.py
--- a/graspy/cluster/base.py
+++ b/graspy/cluster/base.py
@@ -61,19 +61,12 @@ def predict(self, X, y=None):  # pragma: no cover
         -------
         labels : array, shape (n_samples,)
             Component labels.
-
-        ari : float
-            Adjusted Rand index. Only returned if y is given.
         """
         # Check if fit is already called
         check_is_fitted(self, ["model_"], all_or_any=all)
         labels = self.model_.predict(X)
 
-        if y is None:
-            return labels
-        else:
-            ari = adjusted_rand_score(y, labels)
-            return labels, ari
+        return labels
 
     def fit_predict(self, X, y=None):  # pragma: no cover
         """
@@ -93,15 +86,8 @@ def fit_predict(self, X, y=None):  # pragma: no cover
         -------
         labels : array, shape (n_samples,)
             Component labels.
-
-        ari : float
-            Adjusted Rand index. Only returned if y is given.
         """
         self.fit(X, y)
 
-        if y is None:
-            labels = self.predict(X, y)
-            return labels
-        else:
-            labels, ari = self.predict(X, y)
-            return labels, ari
+        labels = self.predict(X, y)
+        return labels


Test patch:
Repository: graspologic-org/graspologic

Issue:
Remove * imports in subgraph, utils
the` __init__.py` files in `graspy.subgraph` and `graspy.utils` shouldn't have import *.


Discussion:

Resolving patch:
diff --git a/graspy/subgraph/__init__.py b/graspy/subgraph/__init__.py
--- a/graspy/subgraph/__init__.py
+++ b/graspy/subgraph/__init__.py
@@ -1,4 +1,7 @@
 # Copyright (c) Microsoft Corporation and contributors.
 # Licensed under the MIT License.
 
-from .sg import *
+
+from .sg import SignalSubgraph
+
+__all__ = [SignalSubgraph]
diff --git a/graspy/utils/__init__.py b/graspy/utils/__init__.py
--- a/graspy/utils/__init__.py
+++ b/graspy/utils/__init__.py
@@ -1,5 +1,42 @@
 # Copyright (c) Microsoft Corporation and contributors.
 # Licensed under the MIT License.
 
-from .utils import *
-from .ptr import *
+from .utils import (
+    import_graph,
+    import_edgelist,
+    is_symmetric,
+    is_loopless,
+    is_unweighted,
+    is_almost_symmetric,
+    symmetrize,
+    remove_loops,
+    to_laplace,
+    is_fully_connected,
+    get_lcc,
+    get_multigraph_union_lcc,
+    get_multigraph_intersect_lcc,
+    augment_diagonal,
+    binarize,
+    cartprod,
+)
+from .ptr import pass_to_ranks
+
+__all__ = [
+    import_graph,
+    import_edgelist,
+    is_symmetric,
+    is_loopless,
+    is_unweighted,
+    is_almost_symmetric,
+    symmetrize,
+    remove_loops,
+    to_laplace,
+    is_fully_connected,
+    get_lcc,
+    get_multigraph_union_lcc,
+    get_multigraph_intersect_lcc,
+    augment_diagonal,
+    binarize,
+    cartprod,
+    pass_to_ranks,
+]


Test patch:
Repository: graspologic-org/graspologic

Issue:
Add tutorial for MASE



Discussion:
I am interested in this one!

Resolving patch:
diff --git a/graspologic/embed/mase.py b/graspologic/embed/mase.py
--- a/graspologic/embed/mase.py
+++ b/graspologic/embed/mase.py
@@ -27,6 +27,8 @@ class MultipleASE(BaseEmbedMulti):
     :math:`R^{(i)}` can be assymetric and non-square, but all graphs still share a
     common latent position matrices :math:`U` and :math:`V`.
 
+    Read more in the :ref:`tutorials <embed_tutorials>`
+
     Parameters
     ----------
     n_components : int or None, default = None


Test patch:
Repository: graspologic-org/graspologic

Issue:
Update GraphMatch docs to reflect fact that negative values are OK



Discussion:

Resolving patch:
diff --git a/graspologic/match/gmp.py b/graspologic/match/gmp.py
--- a/graspologic/match/gmp.py
+++ b/graspologic/match/gmp.py
@@ -157,10 +157,10 @@ def fit(self, A, B, seeds_A=[], seeds_B=[]):
 
         Parameters
         ----------
-        A : 2d-array, square, positive
+        A : 2d-array, square
             A square adjacency matrix
 
-        B : 2d-array, square, positive
+        B : 2d-array, square
             A square adjacency matrix
 
         seeds_A : 1d-array, shape (m , 1) where m <= number of nodes (default = [])
@@ -330,11 +330,11 @@ def fit_predict(self, A, B, seeds_A=[], seeds_B=[]):
 
         Parameters
         ----------
-        A : 2d-array, square, positive
-            A square, positive adjacency matrix
+        A : 2d-array, square
+            A square adjacency matrix
 
-        B : 2d-array, square, positive
-            A square, positive adjacency matrix
+        B : 2d-array, square
+            A square adjacency matrix
 
         seeds_A : 1d-array, shape (m , 1) where m <= number of nodes (default = [])
             An array where each entry is an index of a node in `A`.


Test patch:
Repository: graspologic-org/graspologic

Issue:
[BUG] Seedless Procrustes reference 1 is just a TODO in the docs
see here: https://github.com/microsoft/graspologic/blob/dev/graspologic/align/seedless_procrustes.py#L108


Discussion:
@loftusa would be helpful if you could provide a link to this in the code for any newcomers
> @loftusa would be helpful if you could provide a link to this in the code for any newcomers

edited original post!
@bdpedigo I could not understand the issue properly. Can you explain ?
@loftusa can explain?
@rajpratyush[ line 108 in the documentation for seedless procrustes](https://github.com/microsoft/graspologic/blob/dev/graspologic/align/seedless_procrustes.py#L108) has a #TODO instead of an actual reference. That should be fixed, since we shouldn't have  #TODO in the main documentation.
but do you know the reference @loftusa ? Agterberg's latest paper I think? 
@alyakin314 
lemme go though it overnight and will push a PR in a day or two. @bdpedigo this time I wont forget to run the black code formatting tool before pushing 
@loftusa @bdpedigo First of all, sorry for the delay I wanted to know what is the reference to be added here?


which of these is the work needs to be cited


https://jagterberg.github.io/pages/research.html
@loftusa please address to my query
https://arxiv.org/abs/2012.09828

> On 8 Feb 2021, at 12:34, Pratyush Raj <notifications@github.com> wrote:
> 
> ﻿
> @loftusa please address to my query
> 
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub, or unsubscribe.


Resolving patch:
diff --git a/graspologic/align/seedless_procrustes.py b/graspologic/align/seedless_procrustes.py
--- a/graspologic/align/seedless_procrustes.py
+++ b/graspologic/align/seedless_procrustes.py
@@ -104,8 +104,10 @@ class SeedlessProcrustes(BaseAlign):
 
     References
     ----------
-    .. [1] Agterberg, J.
-        # TODO Cite the Seedless Procrustes preprint whenever available.
+
+    .. [1] Agterberg, J., Tang, M., Priebe., C. E. (2020).
+        "Nonparametric Two-Sample Hypothesis Testing for Random Graphs with Negative and Repeated Eigenvalues"
+        arXiv:2012.09828
 
     .. [2] Agterberg, J., Tang, M., Priebe., C. E. (2020).
         "On Two Distinct Sources of Nonidentifiability in Latent Position Random Graph Models"


Test patch:
Repository: graspologic-org/graspologic

Issue:
see if other graph searches are faster than conversion to networkx for LCC check
https://scikit-learn.org/stable/modules/generated/sklearn.utils.graph_shortest_path.graph_shortest_path.html#sklearn.utils.graph_shortest_path.graph_shortest_path

I am guessing the speedup from not switching datatypes completely pays off


Discussion:
https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csgraph.connected_components.html

https://github.com/scikit-learn/scikit-learn/blob/7b136e9/sklearn/manifold/spectral_embedding_.py#L340

looks like sklearn version calls the scipy one if sparse and has a custom thingy for dense. Could be useful for us
@kareef928 may also be of interest (semi related to #485)
Sure, I think I need a bit of guidance to understand what I am actually doing
for sure! we would have to talk about it. long story short this function gets called for all of our embeddings and right now the way that we do it is super slow. 

Resolving patch:
diff --git a/graspologic/utils/utils.py b/graspologic/utils/utils.py
--- a/graspologic/utils/utils.py
+++ b/graspologic/utils/utils.py
@@ -13,6 +13,7 @@
 import scipy.sparse
 from scipy.optimize import linear_sum_assignment
 from scipy.sparse import csr_matrix, diags, isspmatrix_csr
+from scipy.sparse.csgraph import connected_components
 from sklearn.metrics import confusion_matrix
 from sklearn.utils import check_array, check_consistent_length, column_or_1d
 from sklearn.utils.multiclass import type_of_target, unique_labels
@@ -426,7 +427,8 @@ def is_fully_connected(graph):
 
     Parameters
     ----------
-    graph: nx.Graph, nx.DiGraph, nx.MultiDiGraph, nx.MultiGraph, np.ndarray
+    graph: nx.Graph, nx.DiGraph, nx.MultiDiGraph, nx.MultiGraph,
+        scipy.sparse.csr_matrix, np.ndarray
         Input graph in any of the above specified formats. If np.ndarray,
         interpreted as an :math:`n \times n` adjacency matrix
 
@@ -448,16 +450,20 @@ def is_fully_connected(graph):
     >>> is_fully_connected(a)
     False
     """
+
     if isinstance(graph, (np.ndarray, csr_matrix)):
-        if is_symmetric(graph):
-            g_object = nx.Graph()
-        else:
-            g_object = nx.DiGraph()
-        graph = nx.to_networkx_graph(graph, create_using=g_object)
-    if type(graph) in [nx.Graph, nx.MultiGraph]:
-        return nx.is_connected(graph)
-    elif type(graph) in [nx.DiGraph, nx.MultiDiGraph]:
-        return nx.is_weakly_connected(graph)
+        directed = not is_symmetric(graph)
+
+        n_components = connected_components(
+            csgraph=graph, directed=directed, connection="weak", return_labels=False
+        )
+        return n_components == 1
+
+    else:
+        if type(graph) in [nx.Graph, nx.MultiGraph]:
+            return nx.is_connected(graph)
+        elif type(graph) in [nx.DiGraph, nx.MultiDiGraph]:
+            return nx.is_weakly_connected(graph)
 
 
 def largest_connected_component(graph, return_inds=False):


Test patch:
Repository: graspologic-org/graspologic

Issue:
can import sbm from two different places
`from graspologic.models import sbm`
`from graspologic.simulations import sbm`

Both of these work. when we get sbm from simulations, it's (correctly) the function, but when we get it from models, it's the sbm module. This is confusing to a new user I think


Discussion:
#368 
are you proposing changing the name of the file? 
maybe that'll cause more trouble than it's worth? I'm guessing this will just be fixed with #368 
one temporary measure could just be renaming the file in `.models` to something like "sbm_estimators.py" (adding good first issue label)
@bdpedigo can i work on this??
can ask @loftusa if he has a solution in mind
@loftusa tell me your views on this
@rajpratyush I agree with @bdpedigo 's idea about renaming the file in `.models`. Will have to be careful about making sure that everything else gets refactored properly, since I'm assuming a lot of files import it.
@bdpedigo @loftusa  shall I work on it?
> @bdpedigo @loftusa shall I work on it?

sure!
I want to files that requires modification

@loftusa need your guidance ?
> @loftusa need your guidance ?

Sorry, I'm a little confused on what you mean by "I want to files that requires modification" - could you clarify?

Resolving patch:
diff --git a/graspologic/models/__init__.py b/graspologic/models/__init__.py
--- a/graspologic/models/__init__.py
+++ b/graspologic/models/__init__.py
@@ -3,7 +3,7 @@
 
 from .base import BaseGraphEstimator
 from .er import EREstimator, DCEREstimator
-from .sbm import SBMEstimator, DCSBMEstimator
+from .sbm_estimators import SBMEstimator, DCSBMEstimator
 from .rdpg import RDPGEstimator
 
 __all__ = [
diff --git a/graspologic/models/er.py b/graspologic/models/er.py
--- a/graspologic/models/er.py
+++ b/graspologic/models/er.py
@@ -1,7 +1,7 @@
 # Copyright (c) Microsoft Corporation and contributors.
 # Licensed under the MIT License.
 
-from .sbm import SBMEstimator, DCSBMEstimator
+from .sbm_estimators import SBMEstimator, DCSBMEstimator
 from ..utils import import_graph
 import numpy as np
 
diff --git a/graspologic/models/sbm.py b/graspologic/models/sbm_estimators.py
similarity index 100%
rename from graspologic/models/sbm.py
rename to graspologic/models/sbm_estimators.py


Test patch:
Repository: graspologic-org/graspologic

Issue:
[BUG] Inaccurracy in how to use autokmeans
## Expected Behavior

https://github.com/microsoft/graspologic/blob/10de2bf17b972decbab318568154af226dcd71fa/graspologic/cluster/kclust.py#L16

This line is false; higher silhouette score is better, to my knowledge? https://scikit-learn.org/stable/modules/generated/sklearn.metrics.silhouette_score.html

## Actual Behavior

Documentation correctly reports how to use the package.



Discussion:
Yea highest is best. Code is correct though.
Also the docstring and default value for `max_clusters` are out of agreement:

https://github.com/microsoft/graspologic/blob/10de2bf17b972decbab318568154af226dcd71fa/graspologic/cluster/kclust.py#L20

https://github.com/microsoft/graspologic/blob/10de2bf17b972decbab318568154af226dcd71fa/graspologic/cluster/kclust.py#L47

Resolving patch:
diff --git a/graspologic/cluster/kclust.py b/graspologic/cluster/kclust.py
--- a/graspologic/cluster/kclust.py
+++ b/graspologic/cluster/kclust.py
@@ -18,13 +18,15 @@ class KMeansCluster(BaseCluster):
     """
     KMeans Cluster.
 
-    It computes all possible models from one component to
-    ``max_clusters``. The best model is given by the lowest silhouette score.
+    It computes all possible models from one component to ``max_clusters``.
+    When the true labels are known, the best model is given by the model with highest
+    adjusted Rand index (ARI).
+    Otherwise, the best model is given by the model with highest silhouette score.
 
     Parameters
     ----------
-    max_clusters : int, defaults to 1.
-        The maximum number of mixture components to consider.
+    max_clusters : int, default=2.
+        The maximum number of clusters to consider. Must be ``>=2``.
 
     random_state : int, RandomState instance or None, optional (default=None)
         If int, ``random_state`` is the seed used by the random number generator;
@@ -35,11 +37,11 @@ class KMeansCluster(BaseCluster):
     Attributes
     ----------
     n_clusters_ : int
-        Optimal number of components. If y is given, it is based on largest
-        ARI. Otherwise, it is based on smallest loss.
+        Optimal number of clusters. If y is given, it is based on largest
+        ARI. Otherwise, it is based on highest silhouette score.
 
     model_ : KMeans object
-        Fitted KMeans object fitted with optimal n_components.
+        Fitted KMeans object fitted with ``n_clusters_``.
 
     silhouette_ : list
         List of silhouette scores computed for all possible number


Test patch:
Repository: graspologic-org/graspologic

Issue:
`networkplot` shouldn't have x and y labels
in networkplot, the x-axis and y-axis are labeled x and y by default.

I feel like in most situations that shouldn't be there? usually if you're making a networkplot and x and y coordinate axis don't make any sense, since you're in network space, not euclidean space
<img width="678" alt="Screen Shot 2021-11-14 at 6 44 50 PM" src="https://user-images.githubusercontent.com/12386450/141703620-ad4f9f9a-1e64-4b3b-94d8-b1e45c33a004.png">




Discussion:
Hi, I would like to tackle this issue, is it possible?
I have checked the PR from @mtandon18 and it seems kind of straight forward.

Wouldn't it be a good idea to add x/y labels as parameters and put "" as default? 
Something like:
`
labels: Tuple[str, str] = ("", "")
`
hi @Laozey 

even simpler - i think we can just omit the labels by default, and let the user add them back in matplotlib if they desire. you are welcome to work on this if you'd like
Hi, I would like to tackle this issue, is it possible?
Please let me know if you have already solved it.

Resolving patch:
diff --git a/graspologic/plot/plot.py b/graspologic/plot/plot.py
--- a/graspologic/plot/plot.py
+++ b/graspologic/plot/plot.py
@@ -1399,6 +1399,8 @@ def networkplot(
         )
         ax.add_collection(lc)
         ax.set(xticks=[], yticks=[])
+        ax.set_xlabel("")
+        ax.set_ylabel("")
 
     return ax
 


Test patch:
Repository: graspologic-org/graspologic

Issue:
Fix to repeated compilation of numba
- [x] Does this PR have a descriptive title that could go in our release notes?
- [ ] Does this PR add any new dependencies?
- [ ] Does this PR modify any existing APIs?
   - [ ] Is the change to the API backwards compatible?
- [ ] Have you built the documentation (reference and/or tutorial) and verified the generated documentation is appropriate?

Fixes #946

Utilizes the addition of a global function at the top of the file that calls the nb.jit function a single time instead of in the constructor. This speeds up the compilation and running speed of the code.


Discussion:

Resolving patch:
diff --git a/graspologic/models/edge_swaps.py b/graspologic/models/edge_swaps.py
--- a/graspologic/models/edge_swaps.py
+++ b/graspologic/models/edge_swaps.py
@@ -73,7 +73,7 @@ def __init__(self, adjacency: AdjacencyMatrix, seed: Optional[int] = None):
         else:
             # for numpy input, use numba for JIT compilation
             # NOTE: not convinced numba is helping much here, look into optimizing
-            self._edge_swap_function = nb.jit(_edge_swap)
+            self._edge_swap_function = _edge_swap_numba
 
         self.adjacency = adjacency
 
@@ -211,3 +211,6 @@ def _edge_swap(
     edge_list[orig_inds[0]] = [u, x]
     edge_list[orig_inds[1]] = [v, y]
     return adjacency, edge_list
+
+
+_edge_swap_numba = nb.jit(_edge_swap)


Test patch:
Repository: graspologic-org/graspologic

Issue:
doucumentation of to_laplacians
https://microsoft.github.io/graspologic/latest/reference/reference/utils.html?highlight=laplacian#graspologic.utils.to_laplacian

Seems wrong.  missing sqrts.  I-DAD vs I-DLD.  Also, why do i/o for some and not others?

@ebridge2 



Discussion:
I'd like to take this problem.

Resolving patch:
diff --git a/graspologic/utils/utils.py b/graspologic/utils/utils.py
--- a/graspologic/utils/utils.py
+++ b/graspologic/utils/utils.py
@@ -378,9 +378,8 @@ def to_laplacian(
     r"""
     A function to convert graph adjacency matrix to graph Laplacian.
 
-    Currently supports I-DAD, DAD, and R-DAD Laplacians, where D is the diagonal
-    matrix of degrees of each node raised to the -1/2 power, I is the
-    identity matrix, and A is the adjacency matrix.
+    Currently supports I-DAD, DAD, and R-DAD Laplacians, where D is the diagonal matrix
+    of degrees of each node, I is the identity matrix, and A is the adjacency matrix.
 
     R-DAD is regularized Laplacian: where :math:`D_t = D + regularizer \times I`.
 
@@ -393,12 +392,12 @@ def to_laplacian(
     form: {'I-DAD', 'DAD' (default), 'R-DAD'}, string, optional
 
         - 'I-DAD'
-            Computes :math:`L = I - D_i A D_i`
+            Computes :math:`L = I - D_i^{-1/2} A D_i^{-1/2}`
         - 'DAD'
-            Computes :math:`L = D_o A D_i`
+            Computes :math:`L = D_o^{-1/2} A D_i^{-1/2}`
         - 'R-DAD'
-            Computes :math:`L = D_o^r A D_i^r`
-            where :math:`D_o^r = D_o + regularizer \times I` and likewise for :math:`D_i`
+            Computes :math:`L = D_o(r)^{-1/2} A D_i(r)^{-1/2}`
+            where :math:`D_o(r)^{-1/2} = D_o^{-1/2} + regularizer \times I` and likewise for :math:`D_i(r)^{-1/2}`
 
     regularizer: int, float or None, optional (default=None)
         Constant to add to the degree vector(s). If None, average node degree is added.


Test patch: