Update modular_graph_and_candidates.py
Browse files
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 |
-
|
| 1054 |
-
|
|
|
|
|
|
|
| 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 |
}
|