Molbap HF Staff commited on
Commit
0d825ac
·
verified ·
1 Parent(s): dc64b35

Update modular_graph_and_candidates.py

Browse files
Files changed (1) hide show
  1. modular_graph_and_candidates.py +9 -2
modular_graph_and_candidates.py CHANGED
@@ -1050,10 +1050,17 @@ const link = g.selectAll('path.link')
1050
 
1051
  const linkedByIndex = {};
1052
  timeline.links.forEach(d => {
1053
- linkedByIndex[`${d.source.id},${d.target.id}`] = true;
1054
- linkedByIndex[`${d.target.id},${d.source.id}`] = true;
 
 
1055
  });
1056
 
 
 
 
 
 
1057
  function isConnected(a, b) {
1058
  return linkedByIndex[`${a.id},${b.id}`] || a.id === b.id;
1059
  }
 
1050
 
1051
  const linkedByIndex = {};
1052
  timeline.links.forEach(d => {
1053
+ const s = typeof d.source === 'object' ? d.source.id : d.source;
1054
+ const t = typeof d.target === 'object' ? d.target.id : d.target;
1055
+ linkedByIndex[`${s},${t}`] = true;
1056
+ linkedByIndex[`${t},${s}`] = true;
1057
  });
1058
 
1059
+ function isConnected(a, b) {
1060
+ return linkedByIndex[`${a.id},${b.id}`] || a.id === b.id;
1061
+ }
1062
+
1063
+
1064
  function isConnected(a, b) {
1065
  return linkedByIndex[`${a.id},${b.id}`] || a.id === b.id;
1066
  }