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
dafe4671
Commit
dafe4671
authored
Dec 03, 2018
by
Da Zheng
Committed by
Minjie Wang
Dec 04, 2018
Browse files
[Bug][MXNet] fix an API in immutable graph index. (#233)
parent
b1e8d95e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
6 deletions
+25
-6
python/dgl/immutable_graph_index.py
python/dgl/immutable_graph_index.py
+25
-6
No files found.
python/dgl/immutable_graph_index.py
View file @
dafe4671
...
...
@@ -479,18 +479,37 @@ class ImmutableGraphIndex(object):
return
F
.
copy_to
(
new_mat
,
ctx
)
return
self
.
_sparse
.
adjacency_matrix
(
transpose
,
ctx
)
def
incidence_matrix
(
self
,
oriented
=
False
):
def
incidence_matrix
(
self
,
type
,
ctx
):
"""Return the incidence matrix representation of this graph.
An incidence matrix is an n x m sparse matrix, where n is
the number of nodes and m is the number of edges. Each nnz
value indicating whether the edge is incident to the node
or not.
There are three types of an incidence matrix `I`:
* "in":
- I[v, e] = 1 if e is the in-edge of v (or v is the dst node of e);
- I[v, e] = 0 otherwise.
* "out":
- I[v, e] = 1 if e is the out-edge of v (or v is the src node of e);
- I[v, e] = 0 otherwise.
* "both":
- I[v, e] = 1 if e is the in-edge of v;
- I[v, e] = -1 if e is the out-edge of v;
- I[v, e] = 0 otherwise (including self-loop).
Parameters
----------
oriented : bool, optional (default=False)
Whether the returned incidence matrix is oriented.
type : str
Can be either "in", "out" or "both"
ctx : context
The context of returned incidence matrix.
Returns
-------
utils.CtxCachedObject
An object that returns tensor given context
.
SparseTensor
The incidence matrix
.
"""
raise
Exception
(
'immutable graph doesn
\'
t support incidence_matrix for now.'
)
...
...
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