-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
1 parent
25077aa
commit d21fe54
Showing
3 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
releasenotes/notes/accept-generators-31f080871015233c.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
33
releasenotes/notes/degree-centrality-e7ddf61a9a8fbafc.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |