Spaces:
Running
Running
Support isolated nodes in graph sampling.
Browse files
lynxkite-graph-analytics/src/lynxkite_plugins/graph_analytics/lynxkite_ops.py
CHANGED
@@ -73,11 +73,14 @@ class Bundle:
|
|
73 |
|
74 |
def to_nx(self):
|
75 |
# TODO: Use relations.
|
76 |
-
graph = nx.
|
77 |
if "nodes" in self.dfs:
|
78 |
-
|
79 |
-
|
80 |
)
|
|
|
|
|
|
|
81 |
return graph
|
82 |
|
83 |
def copy(self):
|
|
|
73 |
|
74 |
def to_nx(self):
|
75 |
# TODO: Use relations.
|
76 |
+
graph = nx.DiGraph()
|
77 |
if "nodes" in self.dfs:
|
78 |
+
graph.add_nodes_from(
|
79 |
+
self.dfs["nodes"].set_index("id").to_dict("index").items()
|
80 |
)
|
81 |
+
graph.add_edges_from(
|
82 |
+
self.dfs["edges"][["source", "target"]].itertuples(index=False, name=None)
|
83 |
+
)
|
84 |
return graph
|
85 |
|
86 |
def copy(self):
|