File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
pydatalab/src/pydatalab/routes/v0_1 Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -104,11 +104,14 @@ def get_graph_cy_format(
104104 nodes = []
105105 edges = []
106106
107+ # Collect the elements that have already been added to the graph, to avoid duplication
107108 drawn_elements = set ()
108109 node_collections : set [str ] = set ()
109-
110110 for document in all_documents :
111+ # for some reason, document["relationships"] is sometimes equal to None, so we
112+ # need this `or` statement.
111113 for relationship in document .get ("relationships" ) or []:
114+ # only considering child-parent relationships
112115 if relationship .get ("type" ) == "collections" and not collection_id :
113116 if hide_collections :
114117 continue
@@ -152,6 +155,7 @@ def get_graph_cy_format(
152155 continue
153156
154157 for relationship in document .get ("relationships" ) or []:
158+ # only considering child-parent relationships:
155159 if relationship .get ("relation" ) not in ("parent" , "is_part_of" ):
156160 continue
157161
You can’t perform that action at this time.
0 commit comments