Skip to content

Commit 5427291

Browse files
committed
update doc zh build structure tutorial
1 parent 04831ed commit 5427291

File tree

1 file changed

+97
-1
lines changed

1 file changed

+97
-1
lines changed

docs/source/zh/tutorial/structure.rst

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@
6464
[0., 0., 0., 0., 1.],
6565
[0., 0., 0., 1., 0.]])
6666
67+
.. image:: ../../_static/img/build_structure_graph_from_edge_list.png
68+
:align: center
69+
:alt: Customize size
70+
:height: 400px
71+
72+
6773
可以发现图的邻接矩阵是一个对称矩阵。
6874
:py:attr:`g.e <dhg.Graph.e>` 属性会返回两个列表的元组,第一个列表是边列表,第二个列表是每条边的权重。
6975
:py:attr:`g.e_both_side <dhg.Graph.e_both_side>` 属性会返回图里所有边及其对应的对称形式。
@@ -138,6 +144,12 @@
138144
[1., 1., 1., 1., 0.]])
139145
140146
147+
.. image:: ../../_static/img/build_structure_graph_from_adj.png
148+
:align: center
149+
:alt: Customize size
150+
:height: 400px
151+
152+
141153
从高阶关联结构简化而来
142154
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
143155

@@ -184,6 +196,12 @@
184196
[0., 1., 1., 0., 0., 0., 0., 0., 0.],
185197
[1., 0., 0., 1., 1., 0., 0., 0., 0.]])
186198
199+
.. image:: ../../_static/img/build_structure_graph_from_star_expansion.png
200+
:align: center
201+
:alt: Customize size
202+
:height: 400px
203+
204+
187205
**团扩展** :py:meth:`dhg.Graph.from_hypergraph_clique`
188206

189207
和星扩展不同的是,团扩展不会在图内增加虚拟顶点。
@@ -205,6 +223,12 @@
205223
[1., 1., 1., 0., 1.],
206224
[1., 0., 0., 1., 0.]])
207225
226+
.. image:: ../../_static/img/build_structure_graph_from_clique_expansion.png
227+
:align: center
228+
:alt: Customize size
229+
:height: 400px
230+
231+
208232
**基于HyperGCN的扩展** :py:meth:`dhg.Graph.from_hypergraph_hypergcn`
209233

210234
在论文 `HyperGCN <https://arxiv.org/pdf/1809.02589.pdf>`_ 中, 作者介绍了一种将超图的超边简化为图的边的方法,如下图所示。
@@ -245,6 +269,13 @@
245269
[0.3333, 0.3333, 0.3333, 0.0000, 0.3333],
246270
[0.0000, 0.0000, 0.0000, 0.3333, 0.0000]])
247271
272+
273+
.. image:: ../../_static/img/build_structure_graph_from_hypergcn.png
274+
:align: center
275+
:alt: Customize size
276+
:height: 400px
277+
278+
248279
.. _zh_build_directed_graph:
249280

250281
构建有向图
@@ -282,6 +313,11 @@
282313
[0., 1., 0., 0., 0.],
283314
[0., 0., 1., 0., 0.]])
284315
316+
.. image:: ../../_static/img/build_structure_digraph_from_edge_list.png
317+
:align: center
318+
:alt: Customize size
319+
:height: 400px
320+
285321
可以发现有向图的邻接矩阵不是一个对称矩阵。
286322

287323
使用 :py:meth:`dhg.DiGraph.from_adj_list` 函数 **从邻接列表构建一个有向图**
@@ -302,6 +338,12 @@
302338
[0., 0., 0., 0., 0.]])
303339
304340
341+
.. image:: ../../_static/img/build_structure_digraph_from_adj.png
342+
:align: center
343+
:alt: Customize size
344+
:height: 400px
345+
346+
305347
使用 :py:meth:`dhg.DiGraph.from_feature_kNN` 函数 **根据特征的k近邻构建有向图**
306348

307349
.. code-block:: python
@@ -323,6 +365,11 @@
323365
[1., 0., 1., 0., 0.],
324366
[0., 1., 1., 0., 0.]], dtype=torch.float64)
325367
368+
.. image:: ../../_static/img/build_structure_digraph_from_knn.png
369+
:align: center
370+
:alt: Customize size
371+
:height: 400px
372+
326373

327374
从高阶关联结构简化而来
328375
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -377,6 +424,12 @@
377424
[0., 0., 0., 0., 1., 0., 0., 0., 0.],
378425
[1., 0., 0., 0., 0., 0., 0., 0., 0.]])
379426
427+
.. image:: ../../_static/img/build_structure_bigraph_from_edge_list.png
428+
:align: center
429+
:alt: Customize size
430+
:height: 400px
431+
432+
380433
使用 :py:meth:`dhg.BiGraph.from_adj_list` 函数 **从邻接列表构建一个二分图**
381434

382435
.. code-block:: python
@@ -403,6 +456,13 @@
403456
[1., 1., 0., 0., 1., 0., 0., 0., 0.],
404457
[1., 0., 0., 0., 0., 0., 0., 0., 0.]])
405458
459+
460+
.. image:: ../../_static/img/build_structure_bigraph_from_adj.png
461+
:align: center
462+
:alt: Customize size
463+
:height: 400px
464+
465+
406466
从高阶关联结构简化而来
407467
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
408468

@@ -448,6 +508,12 @@
448508
[1., 0., 0., 1., 1.]])
449509
450510
511+
.. image:: ../../_static/img/build_structure_bigraph_from_hypergraph.png
512+
:align: center
513+
:alt: Customize size
514+
:height: 400px
515+
516+
451517
构建高阶关联结构
452518
-----------------------
453519

@@ -490,6 +556,12 @@
490556
[0., 1., 0.],
491557
[0., 0., 1.]])
492558
559+
.. image:: ../../_static/img/build_structure_hypergraph_from_edge_list.png
560+
:align: center
561+
:alt: Customize size
562+
:height: 400px
563+
564+
493565
.. important::
494566

495567
超图里面的超边是顶点的无序集,也就意味着超边 ``(0, 1, 2)`` 、超边 ``(0, 2, 1)`` 和超边 ``(2, 1, 0)`` 是同一条超边。
@@ -569,6 +641,13 @@ You can find the weight of the last hyperedge is ``1.0`` and ``2.0``, if you set
569641
[0., 0., 0., 0., 1., 0., 0., 1., 0.],
570642
[0., 0., 1., 0., 0., 1., 0., 0., 1.]])
571643
644+
645+
.. image:: ../../_static/img/build_structure_hypergraph_from_knn.png
646+
:align: center
647+
:alt: Customize size
648+
:height: 400px
649+
650+
572651
.. note::
573652

574653
重边根据 ``mean`` 操作合并。
@@ -601,6 +680,11 @@ You can find the weight of the last hyperedge is ``1.0`` and ``2.0``, if you set
601680
[0., 0., 1., 0.],
602681
[0., 0., 0., 1.]])
603682
683+
.. image:: ../../_static/img/build_structure_hypergraph_from_graph.png
684+
:align: center
685+
:alt: Customize size
686+
:height: 400px
687+
604688

605689
使用 :py:meth:`dhg.Hypergraph.from_graph_kHop` 函数 **根据图顶点的k阶邻居构建一个超图**
606690

@@ -634,6 +718,13 @@ You can find the weight of the last hyperedge is ``1.0`` and ``2.0``, if you set
634718
[0., 1., 1.],
635719
[1., 1., 0.]])
636720
721+
722+
.. image:: ../../_static/img/build_structure_hypergraph_from_khop.png
723+
:align: center
724+
:alt: Customize size
725+
:height: 400px
726+
727+
637728
使用 :py:meth:`dhg.Hypergraph.from_bigraph` 函数 **从二分图构建一个超图**
638729

639730
.. code-block:: python
@@ -667,4 +758,9 @@ You can find the weight of the last hyperedge is ``1.0`` and ``2.0``, if you set
667758
tensor([[0., 0., 1.],
668759
[1., 1., 0.],
669760
[0., 1., 0.]])
670-
761+
762+
.. image:: ../../_static/img/build_structure_hypergraph_from_bigraph.png
763+
:align: center
764+
:alt: Customize size
765+
:height: 400px
766+

0 commit comments

Comments
 (0)