summaryrefslogtreecommitdiff
path: root/drawer/src
diff options
context:
space:
mode:
Diffstat (limited to 'drawer/src')
-rw-r--r--drawer/src/drawer/__init__.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/drawer/src/drawer/__init__.py b/drawer/src/drawer/__init__.py
new file mode 100644
index 0000000..ef47fbc
--- /dev/null
+++ b/drawer/src/drawer/__init__.py
@@ -0,0 +1,24 @@
+import networkx as nx
+import tempfile
+
+def main():
+ g6 = "I?opuIiBw"
+ with tempfile.NamedTemporaryFile(delete=False) as f:
+ _ = f.write(g6.encode())
+ _ = f.seek(0)
+ g = nx.read_graph6(f.name)
+
+ tikz_options = "scale=4"
+ node_options = {n: "line width=1.5, draw=black, circle" for n in g.nodes}
+ edge_options = {e: "line width=1.5" for e in g.edges}
+ print(nx.to_latex(
+ g, nx.circular_layout(g),
+ caption=f"Визуализация графа <<{g6}>>",
+ figure_wrapper='\\begin{{figure}}\\centering\n{content}{caption}{label}\n\\end{{figure}}',
+ as_document=False,
+ tikz_options=tikz_options,
+ node_options=node_options,
+ edge_options=edge_options
+ ))
+ # nx.write_latex(g, "graph.tex", as_document=True)
+ # nx.draw(g)