|
64 | 64 | [0., 0., 0., 0., 1.], |
65 | 65 | [0., 0., 0., 1., 0.]]) |
66 | 66 |
|
| 67 | +.. image:: ../../_static/img/build_structure_graph_from_edge_list.png |
| 68 | + :align: center |
| 69 | + :alt: Customize size |
| 70 | + :height: 400px |
| 71 | + |
| 72 | + |
67 | 73 | 可以发现图的邻接矩阵是一个对称矩阵。 |
68 | 74 | :py:attr:`g.e <dhg.Graph.e>` 属性会返回两个列表的元组,第一个列表是边列表,第二个列表是每条边的权重。 |
69 | 75 | :py:attr:`g.e_both_side <dhg.Graph.e_both_side>` 属性会返回图里所有边及其对应的对称形式。 |
|
138 | 144 | [1., 1., 1., 1., 0.]]) |
139 | 145 |
|
140 | 146 |
|
| 147 | +.. image:: ../../_static/img/build_structure_graph_from_adj.png |
| 148 | + :align: center |
| 149 | + :alt: Customize size |
| 150 | + :height: 400px |
| 151 | + |
| 152 | + |
141 | 153 | 从高阶关联结构简化而来 |
142 | 154 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
143 | 155 |
|
|
184 | 196 | [0., 1., 1., 0., 0., 0., 0., 0., 0.], |
185 | 197 | [1., 0., 0., 1., 1., 0., 0., 0., 0.]]) |
186 | 198 |
|
| 199 | +.. image:: ../../_static/img/build_structure_graph_from_star_expansion.png |
| 200 | + :align: center |
| 201 | + :alt: Customize size |
| 202 | + :height: 400px |
| 203 | + |
| 204 | + |
187 | 205 | **团扩展** :py:meth:`dhg.Graph.from_hypergraph_clique` |
188 | 206 |
|
189 | 207 | 和星扩展不同的是,团扩展不会在图内增加虚拟顶点。 |
|
205 | 223 | [1., 1., 1., 0., 1.], |
206 | 224 | [1., 0., 0., 1., 0.]]) |
207 | 225 |
|
| 226 | +.. image:: ../../_static/img/build_structure_graph_from_clique_expansion.png |
| 227 | + :align: center |
| 228 | + :alt: Customize size |
| 229 | + :height: 400px |
| 230 | + |
| 231 | + |
208 | 232 | **基于HyperGCN的扩展** :py:meth:`dhg.Graph.from_hypergraph_hypergcn` |
209 | 233 |
|
210 | 234 | 在论文 `HyperGCN <https://arxiv.org/pdf/1809.02589.pdf>`_ 中, 作者介绍了一种将超图的超边简化为图的边的方法,如下图所示。 |
|
245 | 269 | [0.3333, 0.3333, 0.3333, 0.0000, 0.3333], |
246 | 270 | [0.0000, 0.0000, 0.0000, 0.3333, 0.0000]]) |
247 | 271 |
|
| 272 | +
|
| 273 | +.. image:: ../../_static/img/build_structure_graph_from_hypergcn.png |
| 274 | + :align: center |
| 275 | + :alt: Customize size |
| 276 | + :height: 400px |
| 277 | + |
| 278 | + |
248 | 279 | .. _zh_build_directed_graph: |
249 | 280 |
|
250 | 281 | 构建有向图 |
|
282 | 313 | [0., 1., 0., 0., 0.], |
283 | 314 | [0., 0., 1., 0., 0.]]) |
284 | 315 |
|
| 316 | +.. image:: ../../_static/img/build_structure_digraph_from_edge_list.png |
| 317 | + :align: center |
| 318 | + :alt: Customize size |
| 319 | + :height: 400px |
| 320 | + |
285 | 321 | 可以发现有向图的邻接矩阵不是一个对称矩阵。 |
286 | 322 |
|
287 | 323 | 使用 :py:meth:`dhg.DiGraph.from_adj_list` 函数 **从邻接列表构建一个有向图** |
|
302 | 338 | [0., 0., 0., 0., 0.]]) |
303 | 339 |
|
304 | 340 |
|
| 341 | +.. image:: ../../_static/img/build_structure_digraph_from_adj.png |
| 342 | + :align: center |
| 343 | + :alt: Customize size |
| 344 | + :height: 400px |
| 345 | + |
| 346 | + |
305 | 347 | 使用 :py:meth:`dhg.DiGraph.from_feature_kNN` 函数 **根据特征的k近邻构建有向图** |
306 | 348 |
|
307 | 349 | .. code-block:: python |
|
323 | 365 | [1., 0., 1., 0., 0.], |
324 | 366 | [0., 1., 1., 0., 0.]], dtype=torch.float64) |
325 | 367 |
|
| 368 | +.. image:: ../../_static/img/build_structure_digraph_from_knn.png |
| 369 | + :align: center |
| 370 | + :alt: Customize size |
| 371 | + :height: 400px |
| 372 | + |
326 | 373 |
|
327 | 374 | 从高阶关联结构简化而来 |
328 | 375 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
377 | 424 | [0., 0., 0., 0., 1., 0., 0., 0., 0.], |
378 | 425 | [1., 0., 0., 0., 0., 0., 0., 0., 0.]]) |
379 | 426 |
|
| 427 | +.. image:: ../../_static/img/build_structure_bigraph_from_edge_list.png |
| 428 | + :align: center |
| 429 | + :alt: Customize size |
| 430 | + :height: 400px |
| 431 | + |
| 432 | + |
380 | 433 | 使用 :py:meth:`dhg.BiGraph.from_adj_list` 函数 **从邻接列表构建一个二分图** |
381 | 434 |
|
382 | 435 | .. code-block:: python |
|
403 | 456 | [1., 1., 0., 0., 1., 0., 0., 0., 0.], |
404 | 457 | [1., 0., 0., 0., 0., 0., 0., 0., 0.]]) |
405 | 458 |
|
| 459 | +
|
| 460 | +.. image:: ../../_static/img/build_structure_bigraph_from_adj.png |
| 461 | + :align: center |
| 462 | + :alt: Customize size |
| 463 | + :height: 400px |
| 464 | + |
| 465 | + |
406 | 466 | 从高阶关联结构简化而来 |
407 | 467 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
408 | 468 |
|
|
448 | 508 | [1., 0., 0., 1., 1.]]) |
449 | 509 |
|
450 | 510 |
|
| 511 | +.. image:: ../../_static/img/build_structure_bigraph_from_hypergraph.png |
| 512 | + :align: center |
| 513 | + :alt: Customize size |
| 514 | + :height: 400px |
| 515 | + |
| 516 | + |
451 | 517 | 构建高阶关联结构 |
452 | 518 | ----------------------- |
453 | 519 |
|
|
490 | 556 | [0., 1., 0.], |
491 | 557 | [0., 0., 1.]]) |
492 | 558 |
|
| 559 | +.. image:: ../../_static/img/build_structure_hypergraph_from_edge_list.png |
| 560 | + :align: center |
| 561 | + :alt: Customize size |
| 562 | + :height: 400px |
| 563 | + |
| 564 | + |
493 | 565 | .. important:: |
494 | 566 |
|
495 | 567 | 超图里面的超边是顶点的无序集,也就意味着超边 ``(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 |
569 | 641 | [0., 0., 0., 0., 1., 0., 0., 1., 0.], |
570 | 642 | [0., 0., 1., 0., 0., 1., 0., 0., 1.]]) |
571 | 643 |
|
| 644 | +
|
| 645 | +.. image:: ../../_static/img/build_structure_hypergraph_from_knn.png |
| 646 | + :align: center |
| 647 | + :alt: Customize size |
| 648 | + :height: 400px |
| 649 | + |
| 650 | + |
572 | 651 | .. note:: |
573 | 652 |
|
574 | 653 | 重边根据 ``mean`` 操作合并。 |
@@ -601,6 +680,11 @@ You can find the weight of the last hyperedge is ``1.0`` and ``2.0``, if you set |
601 | 680 | [0., 0., 1., 0.], |
602 | 681 | [0., 0., 0., 1.]]) |
603 | 682 |
|
| 683 | +.. image:: ../../_static/img/build_structure_hypergraph_from_graph.png |
| 684 | + :align: center |
| 685 | + :alt: Customize size |
| 686 | + :height: 400px |
| 687 | + |
604 | 688 |
|
605 | 689 | 使用 :py:meth:`dhg.Hypergraph.from_graph_kHop` 函数 **根据图顶点的k阶邻居构建一个超图** |
606 | 690 |
|
@@ -634,6 +718,13 @@ You can find the weight of the last hyperedge is ``1.0`` and ``2.0``, if you set |
634 | 718 | [0., 1., 1.], |
635 | 719 | [1., 1., 0.]]) |
636 | 720 |
|
| 721 | +
|
| 722 | +.. image:: ../../_static/img/build_structure_hypergraph_from_khop.png |
| 723 | + :align: center |
| 724 | + :alt: Customize size |
| 725 | + :height: 400px |
| 726 | + |
| 727 | + |
637 | 728 | 使用 :py:meth:`dhg.Hypergraph.from_bigraph` 函数 **从二分图构建一个超图** |
638 | 729 |
|
639 | 730 | .. 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 |
667 | 758 | tensor([[0., 0., 1.], |
668 | 759 | [1., 1., 0.], |
669 | 760 | [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