mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-21 13:10:53 +08:00
erase isolated node from graph
This commit is contained in:
@@ -181,6 +181,7 @@ export const PreferentialGraph: FC<{
|
||||
if (!studyDetail.is_preferential || studyDetail.preferences === undefined)
|
||||
return
|
||||
const preferences = reductionPreference(studyDetail.preferences)
|
||||
const trialNodes = Array.from(new Set(preferences.flat()))
|
||||
const graph: ElkNode = {
|
||||
id: "root",
|
||||
layoutOptions: {
|
||||
@@ -189,8 +190,8 @@ export const PreferentialGraph: FC<{
|
||||
"elk.layered.spacing.nodeNodeBetweenLayers": nodeMargin.toString(),
|
||||
"elk.spacing.nodeNode": nodeMargin.toString(),
|
||||
},
|
||||
children: studyDetail.trials.map((trial) => ({
|
||||
id: `${trial.number}`,
|
||||
children: trialNodes.map((trial) => ({
|
||||
id: `${trial}`,
|
||||
targetPosition: "top",
|
||||
sourcePosition: "bottom",
|
||||
width: nodeWidth,
|
||||
@@ -207,7 +208,7 @@ export const PreferentialGraph: FC<{
|
||||
.then((layoutedGraph) => {
|
||||
setNodes(
|
||||
layoutedGraph.children?.map((node, index) => {
|
||||
const trial = studyDetail.trials[index]
|
||||
const trial = studyDetail.trials[trialNodes[index]]
|
||||
return {
|
||||
id: `${trial.number}`,
|
||||
type: "note",
|
||||
|
||||
Reference in New Issue
Block a user