Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenDILab开源决策智能平台
treevalue
提交
5e767310
T
treevalue
项目概览
OpenDILab开源决策智能平台
/
treevalue
大约 1 年 前同步成功
通知
3
Star
213
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
treevalue
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5e767310
编写于
9月 01, 2021
作者:
HansBug
😆
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add most parts of treevalue graph
上级
cf781dc7
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
159 addition
and
1 deletion
+159
-1
docs/source/tutorials/cli_usage/graph_demo_1.demo.sh
docs/source/tutorials/cli_usage/graph_demo_1.demo.sh
+1
-0
docs/source/tutorials/cli_usage/graph_demo_2.demo.sh
docs/source/tutorials/cli_usage/graph_demo_2.demo.sh
+1
-0
docs/source/tutorials/cli_usage/graph_demo_3.demo.sh
docs/source/tutorials/cli_usage/graph_demo_3.demo.sh
+1
-0
docs/source/tutorials/cli_usage/graph_demo_4.demo.sh
docs/source/tutorials/cli_usage/graph_demo_4.demo.sh
+5
-0
docs/source/tutorials/cli_usage/graph_demo_5.demo.sh
docs/source/tutorials/cli_usage/graph_demo_5.demo.sh
+5
-0
docs/source/tutorials/cli_usage/graph_demo_6.demo.sh
docs/source/tutorials/cli_usage/graph_demo_6.demo.sh
+5
-0
docs/source/tutorials/cli_usage/graph_demo_7.demo.sh
docs/source/tutorials/cli_usage/graph_demo_7.demo.sh
+5
-0
docs/source/tutorials/cli_usage/index.rst
docs/source/tutorials/cli_usage/index.rst
+126
-1
docs/source/tutorials/cli_usage/node_share_demo.py
docs/source/tutorials/cli_usage/node_share_demo.py
+10
-0
未找到文件。
docs/source/tutorials/cli_usage/graph_demo_1.demo.sh
0 → 100644
浏览文件 @
5e767310
treevalue graph
-t
'tree_demo.t1'
-o
'only_t1.dat.svg'
\ No newline at end of file
docs/source/tutorials/cli_usage/graph_demo_2.demo.sh
0 → 100644
浏览文件 @
5e767310
treevalue graph
-t
'tree_demo.*'
-o
't1_t2_t3.dat.svg'
\ No newline at end of file
docs/source/tutorials/cli_usage/graph_demo_3.demo.sh
0 → 100644
浏览文件 @
5e767310
treevalue graph
-t
'node_share_demo.*'
-o
'shared_nodes.dat.svg'
docs/source/tutorials/cli_usage/graph_demo_4.demo.sh
0 → 100644
浏览文件 @
5e767310
treevalue graph
\
-t
'node_share_demo.*'
\
-o
'shared_nodes_with_cfg.dat.svg'
\
-T
'Graph to Show the Shared Nodes'
\
-c
'bgcolor=#ffffff00'
docs/source/tutorials/cli_usage/graph_demo_5.demo.sh
0 → 100644
浏览文件 @
5e767310
treevalue graph
\
-t
'node_share_demo.*'
\
-o
'shared_nodes.dat.png'
\
-T
'PNG Formatted Graph'
\
-c
'bgcolor=#ffffff00'
docs/source/tutorials/cli_usage/graph_demo_6.demo.sh
0 → 100644
浏览文件 @
5e767310
treevalue graph
\
-t
'node_share_demo.*'
\
-o
'shared_nodes.dat.gv'
\
-T
'PNG Formatted Graph'
\
-c
'bgcolor=#ffffff00'
docs/source/tutorials/cli_usage/graph_demo_7.demo.sh
0 → 100644
浏览文件 @
5e767310
treevalue graph
\
-t
'node_share_demo.*'
\
-O
\
-T
'PNG Formatted Graph'
\
-c
'bgcolor=#ffffff00'
docs/source/tutorials/cli_usage/index.rst
浏览文件 @
5e767310
C
li
Usage
C
LI
Usage
======================
From treevalue version ``0.1.0``, simple CLI (Command \
...
...
@@ -219,4 +219,129 @@ binary trees can be imported and then drawn to graphs.
* API Documentation of :ref:`apidoc_tree_tree_loads`.
* API Documentation of :ref:`apidoc_tree_tree_graphics`.
Draw One Graph For One Tree
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Before drawing the first graph, we prepare the ``tree_demo.py`` \
mentioned in :ref:`cli_usage_export`.
.. literalinclude:: tree_demo.py
:language: python
:linenos:
We can draw the graph of ``t1`` with the following command
.. literalinclude:: graph_demo_1.demo.sh
:language: shell
:linenos:
The dumped graph ``only_t1.dat.svg`` should be like this
.. image:: only_t1.dat.svg
:align: center
Draw One Graph For Multiple Trees
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Actually we can put several trees into one graph, just like \
the following command
.. literalinclude:: graph_demo_2.demo.sh
:language: shell
:linenos:
The dumped graph ``t1_t2_t3.dat.svg`` should contains 3 trees, \
like this
.. image:: t1_t2_t3.dat.svg
:align: center
Sometime, the trees will share some common nodes (with the same \
``Tree`` object id), this relation will also be displayed in \
graph. In another python script ``node_share_demo.py``
.. literalinclude:: node_share_demo.py
:language: python
:linenos:
The dumped graph ``shared_nodes.dat.svg`` should be like
.. image:: shared_nodes.dat.svg
:align: center
The arrow from ``nt3`` named ``first`` is pointed to ``nt1``, \
the arrow named ``another`` is pointed to ``nt1.x``, and so on.
Graph with Configurations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sometime we need to assign the title of the dumped graph, \
or you may think that the white background look prominent in \
the grey page background. So you can dump the graph like this
.. literalinclude:: graph_demo_4.demo.sh
:language: shell
:linenos:
The dumped graph ``shared_nodes_with_cfg.dat.svg`` should be \
like this
.. image:: shared_nodes_with_cfg.dat.svg
:align: center
We can see the title and the background color is changed \
because of the ``-T`` and ``-c`` command. The transparent \
background looks better than the ``shared_nodes.dat.svg`` \
in the grey page background.
Graph of Different Formats
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you do not need svg format, you can dump it to png format \
like this
.. literalinclude:: graph_demo_5.demo.sh
:language: python
:linenos:
The dumped graph ``shared_nodes.dat.png`` should be like this, \
its format is ``png``.
.. image:: shared_nodes.dat.png
:align: center
Besides, if the graphviz code (``gv`` format) is just all \
what you need, you can dump the ``gv`` source code with the \
following command line.
.. literalinclude:: graph_demo_6.demo.sh
:language: python
:linenos:
The dumped source code ``shared_nodes.dat.gv`` should be like \
this
.. literalinclude:: shared_nodes.dat.gv
:language: graphviz
:linenos:
Or if you need to put it to the ``stdout``, you can do like this
.. literalinclude:: graph_demo_7.demo.sh
:language: python
:linenos:
The output in ``stdout`` should almost the same like the \
source code file ``shared_nodes.dat.gv``.
.. note::
When ``-O`` option is used, the ``-o`` will be ignored.
Reuse the Value Nodes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
docs/source/tutorials/cli_usage/node_share_demo.py
0 → 100644
浏览文件 @
5e767310
from
treevalue
import
FastTreeValue
nt1
=
FastTreeValue
({
'a'
:
1
,
'b'
:
2
,
'x'
:
{
'c'
:
3
,
'd'
:
4
}})
nt2
=
FastTreeValue
({
'a'
:
11
,
'b'
:
24
,
'x'
:
{
'c'
:
30
,
'd'
:
47
}})
nt3
=
FastTreeValue
({
'first'
:
nt1
,
'second'
:
nt2
,
'another'
:
nt1
.
x
,
'sum'
:
nt1
+
nt2
,
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录