rm CondaPkg environment

This commit is contained in:
ton
2023-04-06 13:53:47 +07:00
parent 0a57ed7884
commit c43d949309
3329 changed files with 5725 additions and 447022 deletions

View File

@@ -704,7 +704,7 @@ def kamada_kawai_layout(
elif dim == 2:
pos = circular_layout(G, dim=dim)
else:
pos = {n: pt for n, pt in zip(G, np.linspace(0, 1, len(G)))}
pos = dict(zip(G, np.linspace(0, 1, len(G))))
pos_arr = np.array([pos[n] for n in G])
pos = _kamada_kawai_solve(dist_mtx, pos_arr, dim)
@@ -1151,7 +1151,7 @@ def arf_layout(
References
.. [1] "Self-Organization Applied to Dynamic Network Layout", M. Geipel,
International Jounral of Modern Physics C, 2007, Vol 18, No 10, pp. 1537-1549.
International Journal of Modern Physics C, 2007, Vol 18, No 10, pp. 1537-1549.
https://doi.org/10.1142/S0129183107011558 https://arxiv.org/abs/0704.1748
Returns
@@ -1220,7 +1220,7 @@ def arf_layout(
if n_iter > max_iter:
break
n_iter += 1
return {node: pi for node, pi in zip(G.nodes(), p)}
return dict(zip(G.nodes(), p))
def rescale_layout(pos, scale=1):

View File

@@ -8,7 +8,7 @@ Usually, you will want the drawing to appear in a figure environment so
you use ``to_latex(G, caption="A caption")``. If you want the raw
drawing commands without a figure environment use :func:`to_latex_raw`.
And if you want to write to a file instead of just returning the latex
code as a string, use ``write_latex(G, "filname.tex", caption="A caption")``.
code as a string, use ``write_latex(G, "filename.tex", caption="A caption")``.
To construct a figure with subfigures for each graph to be shown, provide
``to_latex`` or ``write_latex`` a list of graphs, a list of subcaptions,
@@ -217,8 +217,8 @@ def to_latex_raw(
if not isinstance(pos, dict):
pos = nx.get_node_attributes(G, pos)
if not pos:
# circular layout with radius 1
pos = {n: f"({round(2* 3.1415 * i / len(G), 3)}:10)" for i, n in enumerate(G)}
# circular layout with radius 2
pos = {n: f"({round(360.0 * i / len(G), 3)}:2)" for i, n in enumerate(G)}
for node in G:
if node not in pos:
raise nx.NetworkXError(f"node {node} has no specified pos {pos}")
@@ -334,7 +334,7 @@ def to_latex(
The TikZ drawing utility in LaTeX is used to draw the graph(s).
If `Gbunch` is a graph, it is drawn in a figure environment.
If `Gbunch` is an iterable of graphs, each is drawn in a subfigure envionment
If `Gbunch` is an iterable of graphs, each is drawn in a subfigure environment
within a single figure environment.
If `as_document` is True, the figure is wrapped inside a document environment
@@ -397,7 +397,7 @@ def to_latex(
n_rows : int
The number of rows of subfigures to arrange for multiple graphs
as_document : bool
Whether to wrap the latex code in a document envionment for compiling
Whether to wrap the latex code in a document environment for compiling
document_wrapper : formatted text string with variable ``content``.
This text is called to evaluate the content embedded in a document
environment with a preamble setting up TikZ.
@@ -485,7 +485,7 @@ def write_latex(Gbunch, path, **options):
This convenience function creates the latex drawing code as a string
and writes that to a file ready to be compiled when `as_document` is True
or ready to be ``\\import``ed or `\\include``ed into your main LaTeX document.
or ready to be ``import`` ed or ``include`` ed into your main LaTeX document.
The `path` argument can be a string filename or a file handle to write to.
@@ -494,75 +494,75 @@ def write_latex(Gbunch, path, **options):
Gbunch : NetworkX graph or iterable of NetworkX graphs
If Gbunch is a graph, it is drawn in a figure environment.
If Gbunch is an iterable of graphs, each is drawn in a subfigure
envionment within a single figure environment.
environment within a single figure environment.
path : filename
Filename or file handle to write to
options : dict
By default, TikZ is used with options: (others are ignored):
By default, TikZ is used with options: (others are ignored)::
pos : string or dict or list
The name of the node attribute on `G` that holds the position of each node.
Positions can be sequences of length 2 with numbers for (x,y) coordinates.
They can also be strings to denote positions in TikZ style, such as (x, y)
or (angle:radius).
If a dict, it should be keyed by node to a position.
If an empty dict, a circular layout is computed by TikZ.
If you are drawing many graphs in subfigures, use a list of position dicts.
tikz_options : string
The tikzpicture options description defining the options for the picture.
Often large scale options like `[scale=2]`.
default_node_options : string
The draw options for a path of nodes. Individual node options override these.
node_options : string or dict
The name of the node attribute on `G` that holds the options for each node.
Or a dict keyed by node to a string holding the options for that node.
node_label : string or dict
The name of the node attribute on `G` that holds the node label (text)
displayed for each node. If the attribute is "" or not present, the node
itself is drawn as a string. LaTeX processing such as ``"$A_1$"`` is allowed.
Or a dict keyed by node to a string holding the label for that node.
default_edge_options : string
The options for the scope drawing all edges. The default is "[-]" for
undirected graphs and "[->]" for directed graphs.
edge_options : string or dict
The name of the edge attribute on `G` that holds the options for each edge.
If the edge is a self-loop and ``"loop" not in edge_options`` the option
"loop," is added to the options for the self-loop edge. Hence you can
use "[loop above]" explicitly, but the default is "[loop]".
Or a dict keyed by edge to a string holding the options for that edge.
edge_label : string or dict
The name of the edge attribute on `G` that holds the edge label (text)
displayed for each edge. If the attribute is "" or not present, no edge
label is drawn.
Or a dict keyed by edge to a string holding the label for that edge.
edge_label_options : string or dict
The name of the edge attribute on `G` that holds the label options for
each edge. For example, "[sloped,above,blue]". The default is no options.
Or a dict keyed by edge to a string holding the label options for that edge.
caption : string
The caption string for the figure environment
latex_label : string
The latex label used for the figure for easy referral from the main text
sub_captions : list of strings
The sub_caption string for each subfigure in the figure
sub_latex_labels : list of strings
The latex label for each subfigure in the figure
n_rows : int
The number of rows of subfigures to arrange for multiple graphs
as_document : bool
Whether to wrap the latex code in a document envionment for compiling
document_wrapper : formatted text string with variable ``content``.
This text is called to evaluate the content embedded in a document
environment with a preamble setting up the TikZ syntax.
figure_wrapper : formatted text string
This text is evaluated with variables ``content``, ``caption`` and ``label``.
It wraps the content and if a caption is provided, adds the latex code for
that caption, and if a label is provided, adds the latex code for a label.
subfigure_wrapper : formatted text string
This text evaluate variables ``size``, ``content``, ``caption`` and ``label``.
It wraps the content and if a caption is provided, adds the latex code for
that caption, and if a label is provided, adds the latex code for a label.
The size is the vertical size of each row of subfigures as a fraction.
pos : string or dict or list
The name of the node attribute on `G` that holds the position of each node.
Positions can be sequences of length 2 with numbers for (x,y) coordinates.
They can also be strings to denote positions in TikZ style, such as (x, y)
or (angle:radius).
If a dict, it should be keyed by node to a position.
If an empty dict, a circular layout is computed by TikZ.
If you are drawing many graphs in subfigures, use a list of position dicts.
tikz_options : string
The tikzpicture options description defining the options for the picture.
Often large scale options like `[scale=2]`.
default_node_options : string
The draw options for a path of nodes. Individual node options override these.
node_options : string or dict
The name of the node attribute on `G` that holds the options for each node.
Or a dict keyed by node to a string holding the options for that node.
node_label : string or dict
The name of the node attribute on `G` that holds the node label (text)
displayed for each node. If the attribute is "" or not present, the node
itself is drawn as a string. LaTeX processing such as ``"$A_1$"`` is allowed.
Or a dict keyed by node to a string holding the label for that node.
default_edge_options : string
The options for the scope drawing all edges. The default is "[-]" for
undirected graphs and "[->]" for directed graphs.
edge_options : string or dict
The name of the edge attribute on `G` that holds the options for each edge.
If the edge is a self-loop and ``"loop" not in edge_options`` the option
"loop," is added to the options for the self-loop edge. Hence you can
use "[loop above]" explicitly, but the default is "[loop]".
Or a dict keyed by edge to a string holding the options for that edge.
edge_label : string or dict
The name of the edge attribute on `G` that holds the edge label (text)
displayed for each edge. If the attribute is "" or not present, no edge
label is drawn.
Or a dict keyed by edge to a string holding the label for that edge.
edge_label_options : string or dict
The name of the edge attribute on `G` that holds the label options for
each edge. For example, "[sloped,above,blue]". The default is no options.
Or a dict keyed by edge to a string holding the label options for that edge.
caption : string
The caption string for the figure environment
latex_label : string
The latex label used for the figure for easy referral from the main text
sub_captions : list of strings
The sub_caption string for each subfigure in the figure
sub_latex_labels : list of strings
The latex label for each subfigure in the figure
n_rows : int
The number of rows of subfigures to arrange for multiple graphs
as_document : bool
Whether to wrap the latex code in a document environment for compiling
document_wrapper : formatted text string with variable ``content``.
This text is called to evaluate the content embedded in a document
environment with a preamble setting up the TikZ syntax.
figure_wrapper : formatted text string
This text is evaluated with variables ``content``, ``caption`` and ``label``.
It wraps the content and if a caption is provided, adds the latex code for
that caption, and if a label is provided, adds the latex code for a label.
subfigure_wrapper : formatted text string
This text evaluate variables ``size``, ``content``, ``caption`` and ``label``.
It wraps the content and if a caption is provided, adds the latex code for
that caption, and if a label is provided, adds the latex code for a label.
The size is the vertical size of each row of subfigures as a fraction.
See Also
========

View File

@@ -289,7 +289,7 @@ def draw_networkx(G, pos=None, arrows=None, with_labels=True, **kwds):
"with_labels",
}
if any([k not in valid_kwds for k in kwds]):
if any(k not in valid_kwds for k in kwds):
invalid_args = ", ".join([k for k in kwds if k not in valid_kwds])
raise ValueError(f"Received invalid argument(s): {invalid_args}")
@@ -1184,7 +1184,7 @@ def draw_networkx_edge_labels(
trans_angle = 0.0
# use default box of white with white border
if bbox is None:
bbox = dict(boxstyle="round", ec=(1.0, 1.0, 1.0), fc=(1.0, 1.0, 1.0))
bbox = {"boxstyle": "round", "ec": (1.0, 1.0, 1.0), "fc": (1.0, 1.0, 1.0)}
if not isinstance(label, str):
label = str(label) # this makes "1" and 1 labeled the same

View File

@@ -357,7 +357,6 @@ class TestLayout:
self.check_kamada_kawai_costfn(pos, invdist, meanwt, 3)
def test_spiral_layout(self):
G = self.Gs
# a lower value of resolution should result in a more compact layout

View File

@@ -197,7 +197,7 @@ def test_more_edge_colors_than_num_edges_directed():
assert mpl.colors.same_color(fap.get_edgecolor(), expected)
def test_edge_color_string_with_gloabl_alpha_undirected():
def test_edge_color_string_with_global_alpha_undirected():
edge_collection = nx.draw_networkx_edges(
barbell,
pos=nx.random_layout(barbell),