Skip to content

Commit

Permalink
Add missing release notes for #1292 and #1306 (#1336)
Browse files Browse the repository at this point in the history
* Add release notes for #1292

* Add release notes for degree centrality

* Add centrality entries to the docs

* Update releasenotes/notes/accept-generators-31f080871015233c.yaml

Co-authored-by: Matthew Treinish <[email protected]>

* Update releasenotes/notes/accept-generators-31f080871015233c.yaml

---------

Co-authored-by: Matthew Treinish <[email protected]>
  • Loading branch information
IvanIsCoding and mtreinish authored Dec 17, 2024
1 parent 25077aa commit d21fe54
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/source/api/algorithm_functions/centrality.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ Centrality
:toctree: ../../apiref

rustworkx.betweenness_centrality
rustworkx.degree_centrality
rustworkx.edge_betweenness_centrality
rustworkx.eigenvector_centrality
rustworkx.katz_centrality
rustworkx.closeness_centrality
rustworkx.in_degree_centrality
rustworkx.out_degree_centrality
11 changes: 11 additions & 0 deletions releasenotes/notes/accept-generators-31f080871015233c.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
features:
- |
The following methods now support sequences and generators as inputs, in addition to
the existing support for lists:
* :meth:`~rustworkx.PyGraph.add_nodes_from` and :meth:`~rustworkx.PyDiGraph.add_nodes_from`
* :meth:`~rustworkx.PyGraph.add_edges_from` and :meth:`~rustworkx.PyDiGraph.add_edges_from`
* :meth:`~rustworkx.PyGraph.add_edges_from_no_data` and :meth:`~rustworkx.PyDiGraph.add_edges_from_no_data`
* :meth:`~rustworkx.PyGraph.extend_from_edge_list` and :meth:`~rustworkx.PyDiGraph.extend_from_edge_list`
* :meth:`~rustworkx.PyGraph.extend_from_weighted_edge_list` and :meth:`~rustworkx.PyDiGraph.extend_from_weighted_edge_list`
33 changes: 33 additions & 0 deletions releasenotes/notes/degree-centrality-e7ddf61a9a8fbafc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
features:
- |
Added a new function, :func:`~rustworkx.degree_centrality` which is used to
compute the degree centrality for all nodes in a given graph. For
example:
.. jupyter-execute::
import rustworkx as rx
from rustworkx.visualization import mpl_draw
graph = rx.generators.hexagonal_lattice_graph(4, 4)
centrality = rx.degree_centrality(graph)
# Generate a color list
colors = []
for node in graph.node_indices():
centrality_score = centrality[node]
graph[node] = centrality_score
colors.append(centrality_score)
mpl_draw(
graph,
with_labels=True,
node_color=colors,
node_size=650,
labels=lambda x: "{0:.2f}".format(x)
)
- |
Added two new functions, :func:`~rustworkx.in_degree_centrality` and
:func:`~rustworkx.out_degree_centrality` to calculate two special
types of degree centrality for directed graphs.

0 comments on commit d21fe54

Please sign in to comment.