-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9793b76
Showing
102 changed files
with
16,099 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: 055295f139ce85f6c38a4feb709a6537 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
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,81 @@ | ||
<!DOCTYPE html> | ||
|
||
<html lang="en" data-content_root="../"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Overview: module code — netsci 0.1.dev1+ga9a6549 documentation</title> | ||
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=82a976d7" /> | ||
<link rel="stylesheet" type="text/css" href="../_static/nature.css?v=0f882399" /> | ||
<link rel="stylesheet" type="text/css" href="../_static/graphviz.css?v=fd3f3429" /> | ||
<script src="../_static/documentation_options.js?v=af418c07"></script> | ||
<script src="../_static/doctools.js?v=9a2dae69"></script> | ||
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script> | ||
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script> | ||
<link rel="index" title="Index" href="../genindex.html" /> | ||
<link rel="search" title="Search" href="../search.html" /> | ||
</head><body> | ||
<div class="related" role="navigation" aria-label="Related"> | ||
<h3>Navigation</h3> | ||
<ul> | ||
<li class="right" style="margin-right: 10px"> | ||
<a href="../genindex.html" title="General Index" | ||
accesskey="I">index</a></li> | ||
<li class="right" > | ||
<a href="../py-modindex.html" title="Python Module Index" | ||
>modules</a> |</li> | ||
<li class="nav-item nav-item-0"><a href="../index.html">netsci 0.1.dev1+ga9a6549 documentation</a> »</li> | ||
<li class="nav-item nav-item-this"><a href="">Overview: module code</a></li> | ||
</ul> | ||
</div> | ||
|
||
<div class="document"> | ||
<div class="documentwrapper"> | ||
<div class="bodywrapper"> | ||
<div class="body" role="main"> | ||
|
||
<h1>All modules for which code is available</h1> | ||
<ul><li><a href="netsci/analysis.html">netsci.analysis</a></li> | ||
<li><a href="netsci/plot.html">netsci.plot</a></li> | ||
<li><a href="netsci/utils.html">netsci.utils</a></li> | ||
</ul> | ||
|
||
<div class="clearer"></div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="sphinxsidebar" role="navigation" aria-label="Main"> | ||
<div class="sphinxsidebarwrapper"> | ||
<search id="searchbox" style="display: none" role="search"> | ||
<h3 id="searchlabel">Quick search</h3> | ||
<div class="searchformwrapper"> | ||
<form class="search" action="../search.html" method="get"> | ||
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/> | ||
<input type="submit" value="Go" /> | ||
</form> | ||
</div> | ||
</search> | ||
<script>document.getElementById('searchbox').style.display = "block"</script> | ||
</div> | ||
</div> | ||
<div class="clearer"></div> | ||
</div> | ||
<div class="related" role="navigation" aria-label="Related"> | ||
<h3>Navigation</h3> | ||
<ul> | ||
<li class="right" style="margin-right: 10px"> | ||
<a href="../genindex.html" title="General Index" | ||
>index</a></li> | ||
<li class="right" > | ||
<a href="../py-modindex.html" title="Python Module Index" | ||
>modules</a> |</li> | ||
<li class="nav-item nav-item-0"><a href="../index.html">netsci 0.1.dev1+ga9a6549 documentation</a> »</li> | ||
<li class="nav-item nav-item-this"><a href="">Overview: module code</a></li> | ||
</ul> | ||
</div> | ||
<div class="footer" role="contentinfo"> | ||
© Copyright 2024, Abolfazl Ziaeemehr. | ||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.4.7. | ||
</div> | ||
</body> | ||
</html> |
Large diffs are not rendered by default.
Oops, something went wrong.
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,181 @@ | ||
<!DOCTYPE html> | ||
|
||
<html lang="en" data-content_root="../../"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>netsci.plot — netsci 0.1.dev1+ga9a6549 documentation</title> | ||
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=82a976d7" /> | ||
<link rel="stylesheet" type="text/css" href="../../_static/nature.css?v=0f882399" /> | ||
<link rel="stylesheet" type="text/css" href="../../_static/graphviz.css?v=fd3f3429" /> | ||
<script src="../../_static/documentation_options.js?v=af418c07"></script> | ||
<script src="../../_static/doctools.js?v=9a2dae69"></script> | ||
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script> | ||
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script> | ||
<link rel="index" title="Index" href="../../genindex.html" /> | ||
<link rel="search" title="Search" href="../../search.html" /> | ||
</head><body> | ||
<div class="related" role="navigation" aria-label="Related"> | ||
<h3>Navigation</h3> | ||
<ul> | ||
<li class="right" style="margin-right: 10px"> | ||
<a href="../../genindex.html" title="General Index" | ||
accesskey="I">index</a></li> | ||
<li class="right" > | ||
<a href="../../py-modindex.html" title="Python Module Index" | ||
>modules</a> |</li> | ||
<li class="nav-item nav-item-0"><a href="../../index.html">netsci 0.1.dev1+ga9a6549 documentation</a> »</li> | ||
<li class="nav-item nav-item-1"><a href="../index.html" accesskey="U">Module code</a> »</li> | ||
<li class="nav-item nav-item-this"><a href="">netsci.plot</a></li> | ||
</ul> | ||
</div> | ||
|
||
<div class="document"> | ||
<div class="documentwrapper"> | ||
<div class="bodywrapper"> | ||
<div class="body" role="main"> | ||
|
||
<h1>Source code for netsci.plot</h1><div class="highlight"><pre> | ||
<span></span><span class="kn">import</span> <span class="nn">itertools</span> | ||
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span> | ||
<span class="kn">import</span> <span class="nn">networkx</span> <span class="k">as</span> <span class="nn">nx</span> | ||
<span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="k">as</span> <span class="nn">plt</span> | ||
|
||
|
||
|
||
<div class="viewcode-block" id="plot_graph"> | ||
<a class="viewcode-back" href="../../index.html#netsci.plot.plot_graph">[docs]</a> | ||
<span class="k">def</span> <span class="nf">plot_graph</span><span class="p">(</span><span class="n">G</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> | ||
<span class="w"> </span><span class="sd">"""</span> | ||
<span class="sd"> Plots a NetworkX graph with customizable options.</span> | ||
|
||
<span class="sd"> Parameters</span> | ||
<span class="sd"> ----------</span> | ||
<span class="sd"> G : NetworkX graph</span> | ||
<span class="sd"> A NetworkX graph object (e.g., nx.Graph, nx.DiGraph).</span> | ||
<span class="sd"> **kwargs : keyword arguments</span> | ||
<span class="sd"> Additional keyword arguments to customize the plot. These can include:</span> | ||
<span class="sd"> </span> | ||
<span class="sd"> node_color : str or list, optional</span> | ||
<span class="sd"> Color of the nodes (can be a single color or a list of colors).</span> | ||
<span class="sd"> node_size : int or list, optional</span> | ||
<span class="sd"> Size of the nodes (single value or list of sizes).</span> | ||
<span class="sd"> edge_color : str or list, optional</span> | ||
<span class="sd"> Color of the edges (can be a single color or a list of colors).</span> | ||
<span class="sd"> width : float, optional</span> | ||
<span class="sd"> Width of the edges.</span> | ||
<span class="sd"> with_labels : bool, optional</span> | ||
<span class="sd"> Whether to draw node labels or not.</span> | ||
<span class="sd"> font_size : int, optional</span> | ||
<span class="sd"> Size of the font for node labels.</span> | ||
<span class="sd"> font_color : str, optional</span> | ||
<span class="sd"> Color of the font for node labels.</span> | ||
<span class="sd"> title : str, optional</span> | ||
<span class="sd"> Title of the plot.</span> | ||
<span class="sd"> seed : int, optional</span> | ||
<span class="sd"> Seed for the random layout algorithm.</span> | ||
<span class="sd"> figsize : tuple, optional</span> | ||
<span class="sd"> Size of the figure.</span> | ||
<span class="sd"> ax: axes object</span> | ||
<span class="sd"> Axes object to draw the plot on. Defaults to None, which will create a new figure.</span> | ||
<span class="sd"> pos: object, optional</span> | ||
<span class="sd"> Graph layout (e.g., nx.spring_layout, nx.circular_layout), nx.kamada_kaway_layout(G). </span> | ||
<span class="sd"> Defaults to nx.spring_layout(G).</span> | ||
|
||
<span class="sd"> """</span> | ||
|
||
<span class="c1"># Extracting optional arguments</span> | ||
<span class="n">node_color</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"node_color"</span><span class="p">,</span> <span class="s2">"lightblue"</span><span class="p">)</span> | ||
<span class="n">node_size</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"node_size"</span><span class="p">,</span> <span class="mi">300</span><span class="p">)</span> | ||
<span class="n">edge_color</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"edge_color"</span><span class="p">,</span> <span class="s2">"black"</span><span class="p">)</span> | ||
<span class="n">width</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"width"</span><span class="p">,</span> <span class="mf">1.0</span><span class="p">)</span> | ||
<span class="n">with_labels</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"with_labels"</span><span class="p">,</span> <span class="kc">True</span><span class="p">)</span> | ||
<span class="n">font_size</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"font_size"</span><span class="p">,</span> <span class="mi">12</span><span class="p">)</span> | ||
<span class="n">font_color</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"font_color"</span><span class="p">,</span> <span class="s2">"black"</span><span class="p">)</span> | ||
<span class="n">title</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"title"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> | ||
<span class="n">seed</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"seed"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> | ||
<span class="n">edge_labels</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"edge_labels"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> | ||
<span class="n">figsize</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"figsize"</span><span class="p">,</span> <span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">4</span><span class="p">))</span> | ||
<span class="n">ax</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"ax"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> | ||
<span class="n">pos</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"pos"</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> | ||
|
||
<span class="k">if</span> <span class="n">ax</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> | ||
<span class="n">fig</span><span class="p">,</span> <span class="n">ax</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">subplots</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">figsize</span><span class="o">=</span><span class="n">figsize</span><span class="p">)</span> | ||
<span class="n">ax</span><span class="o">.</span><span class="n">axis</span><span class="p">(</span><span class="s2">"off"</span><span class="p">)</span> | ||
|
||
<span class="k">if</span> <span class="n">seed</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> | ||
<span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">seed</span><span class="p">(</span><span class="n">seed</span><span class="p">)</span> | ||
|
||
<span class="k">if</span> <span class="n">pos</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span> | ||
<span class="n">pos</span> <span class="o">=</span> <span class="n">nx</span><span class="o">.</span><span class="n">spring_layout</span><span class="p">(</span> | ||
<span class="n">G</span><span class="p">,</span> <span class="n">seed</span><span class="o">=</span><span class="n">seed</span> | ||
<span class="p">)</span> | ||
|
||
<span class="c1"># Draw the network</span> | ||
<span class="n">nx</span><span class="o">.</span><span class="n">draw</span><span class="p">(</span> | ||
<span class="n">G</span><span class="p">,</span> | ||
<span class="n">pos</span><span class="p">,</span> | ||
<span class="n">node_color</span><span class="o">=</span><span class="n">node_color</span><span class="p">,</span> | ||
<span class="n">node_size</span><span class="o">=</span><span class="n">node_size</span><span class="p">,</span> | ||
<span class="n">edge_color</span><span class="o">=</span><span class="n">edge_color</span><span class="p">,</span> | ||
<span class="n">width</span><span class="o">=</span><span class="n">width</span><span class="p">,</span> | ||
<span class="n">with_labels</span><span class="o">=</span><span class="n">with_labels</span><span class="p">,</span> | ||
<span class="n">font_size</span><span class="o">=</span><span class="n">font_size</span><span class="p">,</span> | ||
<span class="n">font_color</span><span class="o">=</span><span class="n">font_color</span><span class="p">,</span> | ||
<span class="n">ax</span><span class="o">=</span><span class="n">ax</span> | ||
<span class="p">)</span> | ||
|
||
<span class="k">if</span> <span class="n">edge_labels</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> | ||
<span class="n">nx</span><span class="o">.</span><span class="n">draw_networkx_edge_labels</span><span class="p">(</span><span class="n">G</span><span class="p">,</span> <span class="n">pos</span><span class="p">,</span> <span class="n">edge_labels</span><span class="o">=</span><span class="n">edge_labels</span><span class="p">)</span> | ||
|
||
<span class="c1"># Set the plot title</span> | ||
<span class="k">if</span> <span class="n">title</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> | ||
<span class="n">plt</span><span class="o">.</span><span class="n">title</span><span class="p">(</span><span class="n">title</span><span class="p">)</span> | ||
|
||
<span class="k">return</span> <span class="n">ax</span></div> | ||
|
||
|
||
<span class="c1"># Show the plot</span> | ||
<span class="c1"># plt.show()</span> | ||
</pre></div> | ||
|
||
<div class="clearer"></div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="sphinxsidebar" role="navigation" aria-label="Main"> | ||
<div class="sphinxsidebarwrapper"> | ||
<search id="searchbox" style="display: none" role="search"> | ||
<h3 id="searchlabel">Quick search</h3> | ||
<div class="searchformwrapper"> | ||
<form class="search" action="../../search.html" method="get"> | ||
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/> | ||
<input type="submit" value="Go" /> | ||
</form> | ||
</div> | ||
</search> | ||
<script>document.getElementById('searchbox').style.display = "block"</script> | ||
</div> | ||
</div> | ||
<div class="clearer"></div> | ||
</div> | ||
<div class="related" role="navigation" aria-label="Related"> | ||
<h3>Navigation</h3> | ||
<ul> | ||
<li class="right" style="margin-right: 10px"> | ||
<a href="../../genindex.html" title="General Index" | ||
>index</a></li> | ||
<li class="right" > | ||
<a href="../../py-modindex.html" title="Python Module Index" | ||
>modules</a> |</li> | ||
<li class="nav-item nav-item-0"><a href="../../index.html">netsci 0.1.dev1+ga9a6549 documentation</a> »</li> | ||
<li class="nav-item nav-item-1"><a href="../index.html" >Module code</a> »</li> | ||
<li class="nav-item nav-item-this"><a href="">netsci.plot</a></li> | ||
</ul> | ||
</div> | ||
<div class="footer" role="contentinfo"> | ||
© Copyright 2024, Abolfazl Ziaeemehr. | ||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.4.7. | ||
</div> | ||
</body> | ||
</html> |
Oops, something went wrong.