Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dgl
Commits
9c08cd6b
Unverified
Commit
9c08cd6b
authored
Nov 18, 2020
by
Mufei Li
Committed by
GitHub
Nov 18, 2020
Browse files
Update (#2354)
parent
061c2a36
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
docs/source/guide/graph-feature.rst
docs/source/guide/graph-feature.rst
+2
-2
docs/source/guide_cn/graph-feature.rst
docs/source/guide_cn/graph-feature.rst
+2
-2
No files found.
docs/source/guide/graph-feature.rst
View file @
9c08cd6b
...
...
@@ -8,7 +8,7 @@
The nodes and edges of a :class:`~dgl.DGLGraph` can have several user-defined named features for
storing graph-specific properties of the nodes and edges. These features can be accessed
via the :py:attr:`~dgl.DGLGraph.ndata` and :py:attr:`~dgl.DGLGraph.edata` interface. For example, the following code creates two node
features (named ``'x'`` and ``'y'`` in line
5
and
8
) and one edge feature (named ``'x'`` in line
6
).
features (named ``'x'`` and ``'y'`` in line
8
and
15
) and one edge feature (named ``'x'`` in line
9
).
.. code-block:: python
:linenos:
...
...
@@ -45,7 +45,7 @@ Important facts about the :py:attr:`~dgl.DGLGraph.ndata`/:py:attr:`~dgl.DGLGraph
nodes/edges in the graph.
- Features of the same name must have the same dimensionality and data type.
- The feature tensor is in row-major layout -- each row-slice stores the feature of one
node or edge (e.g., see lines 1
0-11
in the above example).
node or edge (e.g., see lines 1
6 and 18
in the above example).
For weighted graphs, one can store the weights as an edge feature as below.
...
...
docs/source/guide_cn/graph-feature.rst
View file @
9c08cd6b
...
...
@@ -7,7 +7,7 @@
:class:`~dgl.DGLGraph` 对象的节点和边可具有多个用户定义的、可命名的特征,以储存图的节点和边的属性。
通过 :py:attr:`~dgl.DGLGraph.ndata` 和 :py:attr:`~dgl.DGLGraph.edata` 接口可访问这些特征。
例如,以下代码创建了2个节点特征(分别在第
5、8
行命名为 ``'x'`` 、 ``'y'`` )和1个边特征(在第
6
行命名为 ``'x'`` )。
例如,以下代码创建了2个节点特征(分别在第
8、15
行命名为 ``'x'`` 、 ``'y'`` )和1个边特征(在第
9
行命名为 ``'x'`` )。
.. code-block:: python
:linenos:
...
...
@@ -39,7 +39,7 @@
- 通过张量分配创建特征时,DGL会将特征赋给图中的每个节点和每条边。该张量的第一维必须与图中节点或边的数量一致。
不能将特征赋给图中节点或边的子集。
- 相同名称的特征必须具有相同的维度和数据类型。
- 特征张量使用"行优先"的原则,即每个行切片储存1个节点或1条边的特征(参考上述示例代码的第1
0~11
行)。
- 特征张量使用"行优先"的原则,即每个行切片储存1个节点或1条边的特征(参考上述示例代码的第1
6和18
行)。
对于加权图,用户可以将权重储存为一个边特征,如下。
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment