Spaces:
Running
Running
Maybe there are no edges.
Browse files
lynxkite-graph-analytics/src/lynxkite_graph_analytics/lynxkite_ops.py
CHANGED
|
@@ -87,17 +87,22 @@ class Bundle:
|
|
| 87 |
if df.index.name != "id":
|
| 88 |
df = df.set_index("id")
|
| 89 |
graph.add_nodes_from(df.to_dict("index").items())
|
| 90 |
-
edges
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
return graph
|
| 102 |
|
| 103 |
def copy(self):
|
|
|
|
| 87 |
if df.index.name != "id":
|
| 88 |
df = df.set_index("id")
|
| 89 |
graph.add_nodes_from(df.to_dict("index").items())
|
| 90 |
+
if "edges" in self.dfs:
|
| 91 |
+
edges = self.dfs["edges"]
|
| 92 |
+
graph.add_edges_from(
|
| 93 |
+
[
|
| 94 |
+
(
|
| 95 |
+
e["source"],
|
| 96 |
+
e["target"],
|
| 97 |
+
{
|
| 98 |
+
k: e[k]
|
| 99 |
+
for k in edges.columns
|
| 100 |
+
if k not in ["source", "target"]
|
| 101 |
+
},
|
| 102 |
+
)
|
| 103 |
+
for e in edges.to_records()
|
| 104 |
+
]
|
| 105 |
+
)
|
| 106 |
return graph
|
| 107 |
|
| 108 |
def copy(self):
|