-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add barabasi_albert_graph random graph functions (#1007)
* Add barabasi_albert_graph random graph functions This commit adds new random graph functions to rustworkx and rustworkx-core to implement a random graph generator using the Barabási–Albert preferential attachment method. It takes an input graph (defaulting to a star graph) and then extends it to a given size. * Switch release note to use mpl_draw instead of graphviz_draw * Apply suggestions from code review Co-authored-by: Edwin Navarro <[email protected]> --------- Co-authored-by: Edwin Navarro <[email protected]>
- Loading branch information
1 parent
f4ee4cf
commit a424009
Showing
7 changed files
with
366 additions
and
2 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
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,20 @@ | ||
--- | ||
features: | ||
- | | ||
Added two new random graph generator functions, | ||
:func:`.directed_barabasi_albert_graph` and :func:`.barabasi_albert_graph`, | ||
to generate a random graph using Barabási–Albert preferential attachment to | ||
extend an input graph. For example: | ||
.. jupyter-execute:: | ||
import rustworkx | ||
from rustworkx.visualization import mpl_draw | ||
starting_graph = rustworkx.generators.path_graph(10) | ||
random_graph = rustworkx.barabasi_albert_graph(20, 10, initial_graph=starting_graph) | ||
mpl_draw(random_graph) | ||
- | | ||
Added a new function to the rustworkx-core module ``rustworkx_core::generators`` | ||
``barabasi_albert_graph()`` which is used to generate a random graph | ||
using Barabási–Albert preferential attachment to extend an input graph. |
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
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
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
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
Oops, something went wrong.