@@ -1966,14 +1966,14 @@ def average_degree(self) -> float:
19661966
19671967 # MATRIX REPRESENTATIONS
19681968
1969- def Laplacian (self ) -> NDArray :
1969+ def laplacian (self ) -> NDArray :
19701970 """
19711971 Laplacian matrix for the graph
19721972
19731973 :return: Laplacian matrix
19741974 :rtype: NumPy ndarray
19751975
1976- ``g.Laplacian ()`` is the Laplacian matrix (NxN) of the graph where N
1976+ ``g.laplacian ()`` is the Laplacian matrix (NxN) of the graph where N
19771977 is the number of vertices.
19781978
19791979 .. runblock:: pycon
@@ -1987,7 +1987,7 @@ def Laplacian(self) -> NDArray:
19871987 >>> for i, j in [(0, 1), (0, 2), (0, 3), (1, 2), (1, 3), (3, 4)]:
19881988 ... g.add_edge(g[i], g[j])
19891989 ...
1990- >>> L = g.Laplacian ()
1990+ >>> L = g.laplacian ()
19911991 >>> print(L)
19921992
19931993 .. note::
@@ -2023,6 +2023,24 @@ def Laplacian(self) -> NDArray:
20232023 """
20242024 return np .diag ([v .out_degree for v in self ]) - self .adjacency ()
20252025
2026+ def Laplacian (self ) -> NDArray :
2027+ """
2028+ Laplacian matrix for the graph (deprecated)
2029+
2030+ .. deprecated:: 1.0
2031+ Use :meth:`laplacian` instead. A capitalized name denotes a class
2032+ method that constructs a graph, like :meth:`Adjacency` and
2033+ :meth:`Dict`; this is an instance method that returns a matrix.
2034+
2035+ :seealso: :meth:`laplacian`
2036+ """
2037+ warnings .warn (
2038+ "Laplacian() is deprecated, use laplacian() instead" ,
2039+ DeprecationWarning ,
2040+ stacklevel = 2 ,
2041+ )
2042+ return self .laplacian ()
2043+
20262044 def connectivity (self , vertices : Iterable [BaseVertex ] | None = None ) -> list [int ]:
20272045 """
20282046 Graph connectivity
@@ -2094,7 +2112,7 @@ def degree(self) -> NDArray:
20942112 For a ``DGraph`` this was the out-degree matrix, counting only the
20952113 edges leaving each vertex. It is now the total, in plus out. The
20962114 old matrix is ``np.diag([v.out_degree for v in g])``, which is what
2097- :meth:`Laplacian ` uses.
2115+ :meth:`laplacian ` uses.
20982116
20992117 .. runblock:: pycon
21002118
@@ -2116,7 +2134,7 @@ def degree(self) -> NDArray:
21162134 add ``k`` to the degree of each end. A self-loop adds 2, for both
21172135 kinds of graph, since it has two ends.
21182136
2119- :seealso: :meth:`adjacency` :meth:`incidence` :meth:`Laplacian `
2137+ :seealso: :meth:`adjacency` :meth:`incidence` :meth:`laplacian `
21202138 :meth:`connectivity` :meth:`average_degree` :attr:`BaseVertex.degree`
21212139 """
21222140
@@ -2166,7 +2184,7 @@ def adjacency(self) -> NDArray:
21662184 (consistent with :meth:`degree`) and 1 for a ``DGraph``. In every case
21672185 each row of ``A`` sums to the degree of that vertex.
21682186
2169- :seealso: :meth:`Laplacian ` :meth:`incidence` :meth:`degree`
2187+ :seealso: :meth:`laplacian ` :meth:`incidence` :meth:`degree`
21702188 """
21712189 # create a dict mapping vertex to an id
21722190 vdict = {}
@@ -2222,7 +2240,7 @@ def incidence(self) -> NDArray:
22222240 so row sums still equal :meth:`degree`); for a ``DGraph`` it holds a
22232241 single 1.
22242242
2225- :seealso: :meth:`Laplacian ` :meth:`adjacency` :meth:`degree`
2243+ :seealso: :meth:`laplacian ` :meth:`adjacency` :meth:`degree`
22262244 """
22272245 edges = self .edges ()
22282246 I = np .zeros ((self .n , len (edges )))
0 commit comments