Skip to content

unable to layout compound graphΒ #467

@qkaihui

Description

@qkaihui

// code
const g = new dagre.graphlib.Graph({compound:true})
g.setGraph({ rankdir: 'TB', nodesep: 100, ranksep: 80,marginx:100,marginy:100,})
g.setDefaultEdgeLabel(() => ({}))

nodes.forEach((node) => {
const {width,height} = node.size()
const parentId = node?.parent?.id ?? undefined
if(parentId) g.setParent(node.id,parentId)
g.setNode(node.id, {label:${node.id},width, height})
})
dagre.layout(g)

// console error
chunk-YSKSNXDD.js?v=349623b9:5910 Uncaught TypeError: Cannot set properties of undefined (setting 'rank')

How should I solve this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions