Skip to content

Commit

Permalink
removed usage of to_dot in docs (#642)
Browse files Browse the repository at this point in the history
  • Loading branch information
prakharb10 committed Jul 18, 2022
1 parent 657e291 commit 79fe7f5
Showing 1 changed file with 12 additions and 68 deletions.
80 changes: 12 additions & 68 deletions src/generators.rs
Expand Up @@ -1277,7 +1277,7 @@ pub fn directed_binomial_tree_graph(
/// ... S ...
///
/// NOTE: This function generates the four-frequency variant of the heavy square code.
/// This function implements Fig 10.b left of the [paper](https://arxiv.org/abs/1907.09528).
/// This function implements Fig 10.b left of the `paper <https://arxiv.org/abs/1907.09528>`_.
/// This function doesn't support the variant Fig 10.b right.
///
/// Note that if ``d`` is set to ``1`` a :class:`~retworkx.PyGraph` with a
Expand All @@ -1296,26 +1296,12 @@ pub fn directed_binomial_tree_graph(
///
/// .. jupyter-execute::
///
/// import os
/// import tempfile
///
/// import pydot
/// from PIL import Image
///
/// import retworkx.generators
/// from retworkx.visualization import graphviz_draw
///
/// graph = retworkx.generators.heavy_square_graph(3)
/// dot_str = graph.to_dot(
/// lambda node: dict(
/// graphviz_draw(graph, lambda node: dict(
/// color='black', fillcolor='lightblue', style='filled'))
/// dot = pydot.graph_from_dot_data(dot_str)[0]
///
/// with tempfile.TemporaryDirectory() as tmpdirname:
/// tmp_path = os.path.join(tmpdirname, 'dag.png')
/// dot.write_png(tmp_path)
/// image = Image.open(tmp_path)
/// os.remove(tmp_path)
/// image
///
#[pyfunction(multigraph = true)]
#[pyo3(text_signature = "(d, /, multigraph=True)")]
Expand Down Expand Up @@ -1423,7 +1409,7 @@ pub fn heavy_square_graph(py: Python, d: usize, multigraph: bool) -> PyResult<gr
/// ... S ...
///
/// NOTE: This function generates the four-frequency variant of the heavy square code.
/// This function implements Fig 10.b left of the [paper](https://arxiv.org/abs/1907.09528).
/// This function implements Fig 10.b left of the `paper <https://arxiv.org/abs/1907.09528>`_.
/// This function doesn't support the variant Fig 10.b right.
///
/// :param int d: distance of the code. If ``d`` is set to ``1`` a
Expand All @@ -1439,26 +1425,12 @@ pub fn heavy_square_graph(py: Python, d: usize, multigraph: bool) -> PyResult<gr
///
/// .. jupyter-execute::
///
/// import os
/// import tempfile
///
/// import pydot
/// from PIL import Image
///
/// import retworkx.generators
/// from retworkx.visualization import graphviz_draw
///
/// graph = retworkx.generators.heavy_square_graph(3)
/// dot_str = graph.to_dot(
/// lambda node: dict(
/// graph = retworkx.generators.directed_heavy_square_graph(3)
/// graphviz_draw(graph, lambda node: dict(
/// color='black', fillcolor='lightblue', style='filled'))
/// dot = pydot.graph_from_dot_data(dot_str)[0]
///
/// with tempfile.TemporaryDirectory() as tmpdirname:
/// tmp_path = os.path.join(tmpdirname, 'dag.png')
/// dot.write_png(tmp_path)
/// image = Image.open(tmp_path)
/// os.remove(tmp_path)
/// image
///
#[pyfunction(bidirectional = false, multigraph = true)]
#[pyo3(text_signature = "(d, /, bidirectional=False, multigraph=True)")]
Expand Down Expand Up @@ -1630,26 +1602,12 @@ pub fn directed_heavy_square_graph(
///
/// .. jupyter-execute::
///
/// import os
/// import tempfile
///
/// import pydot
/// from PIL import Image
///
/// import retworkx.generators
/// from retworkx.visualization import graphviz_draw
///
/// graph = retworkx.generators.heavy_hex_graph(3)
/// dot_str = graph.to_dot(
/// lambda node: dict(
/// graphviz_draw(graph, lambda node: dict(
/// color='black', fillcolor='lightblue', style='filled'))
/// dot = pydot.graph_from_dot_data(dot_str)[0]
///
/// with tempfile.TemporaryDirectory() as tmpdirname:
/// tmp_path = os.path.join(tmpdirname, 'dag.png')
/// dot.write_png(tmp_path)
/// image = Image.open(tmp_path)
/// os.remove(tmp_path)
/// image
///
#[pyfunction(multigraph = true)]
#[pyo3(text_signature = "(d, /, multigraph=True)")]
Expand Down Expand Up @@ -1792,26 +1750,12 @@ pub fn heavy_hex_graph(py: Python, d: usize, multigraph: bool) -> PyResult<graph
///
/// .. jupyter-execute::
///
/// import os
/// import tempfile
///
/// import pydot
/// from PIL import Image
///
/// import retworkx.generators
/// from retworkx.visualization import graphviz_draw
///
/// graph = retworkx.generators.heavy_hex_graph(3)
/// dot_str = graph.to_dot(
/// lambda node: dict(
/// graph = retworkx.generators.directed_heavy_hex_graph(3)
/// graphviz_draw(graph, lambda node: dict(
/// color='black', fillcolor='lightblue', style='filled'))
/// dot = pydot.graph_from_dot_data(dot_str)[0]
///
/// with tempfile.TemporaryDirectory() as tmpdirname:
/// tmp_path = os.path.join(tmpdirname, 'dag.png')
/// dot.write_png(tmp_path)
/// image = Image.open(tmp_path)
/// os.remove(tmp_path)
/// image
///
#[pyfunction(bidirectional = false, multigraph = true)]
#[pyo3(text_signature = "(d, /, bidirectional=False, multigraph=True)")]
Expand Down

0 comments on commit 79fe7f5

Please sign in to comment.