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
f1ede61f
Commit
f1ede61f
authored
Oct 18, 2018
by
Gan Quan
Browse files
removing obsolete line_graph()
parent
fb6be9fb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
42 deletions
+0
-42
python/dgl/generator/__init__.py
python/dgl/generator/__init__.py
+0
-4
python/dgl/generator/line.py
python/dgl/generator/line.py
+0
-38
No files found.
python/dgl/generator/__init__.py
deleted
100644 → 0
View file @
fb6be9fb
"""Package for graph generators"""
from
__future__
import
absolute_import
from
.line
import
*
python/dgl/generator/line.py
deleted
100644 → 0
View file @
fb6be9fb
"""Line graph generator."""
from
__future__
import
absolute_import
import
networkx
as
nx
import
numpy
as
np
from
..
import
backend
as
F
from
..graph
import
DGLGraph
from
..frame
import
FrameRef
def
line_graph
(
G
,
no_backtracking
=
False
):
"""Create the line graph that shares the underlying features.
The node features of the result line graph will share the edge features
of the given graph.
Parameters
----------
G : DGLGraph
The input graph.
no_backtracking : bool
Whether the backtracking edges are included in the line graph.
If i~j and j~i are two edges in original graph G, then
(i,j)~(j,i) and (j,i)~(i,j) are the "backtracking" edges on
the line graph.
"""
L
=
nx
.
DiGraph
()
for
eid
,
from_node
in
enumerate
(
G
.
edge_list
):
L
.
add_node
(
from_node
)
for
to_node
in
G
.
edges
(
from_node
[
1
]):
if
no_backtracking
and
to_node
[
1
]
==
from_node
[
0
]:
continue
L
.
add_edge
(
from_node
,
to_node
)
relabel_map
=
{}
for
i
,
e
in
enumerate
(
G
.
edge_list
):
relabel_map
[
e
]
=
i
nx
.
relabel
.
relabel_nodes
(
L
,
relabel_map
,
copy
=
False
)
return
DGLGraph
(
L
,
node_frame
=
G
.
_edge_frame
)
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