Search code examples
graphviz

How do I set a node locally for subgraph?


In the image below, I want to represent the 'end' of process:

'end' node

Here's my codes:

digraph anim_retargetting
{
    layout=dot
    compound=true
    fontname="Verdana"
    subgraph cluster_concept {
        style=filled
        color=lightgrey
        label = "Concept"

        edge [label=" needs"]
        node [shape=Msquare]
        "share skeleton animation" -> "same skeleton asset" -> "same skeleton"
    }

    subgraph cluster_setup_humanoid_rig
    {
        style=filled
        color=lightgrey
        label="Setup 'Humanoid Rig'"
        "Pick 'Humanoid Rig'"

        node [style=bold]
        "Pick 'Humanoid Rig'" -> "Mapping bones with Skeleton and Rig."
    }
    subgraph cluster_setup_the_rig_relationship
    {
        style=filled
        color=lightgrey
        label="Setup the rig relationship"
        "Are both skeletons the same?" -> "Yes"
        "Are both skeletons the same?" -> "No" ->
        "Pick 'UE4 Humanoid' skeleton" -> "Pick 'Mixamo' skeleton"

        node [style=bold]
        "Yes" -> "end"
        "Pick 'Mixamo' skeleton" -> "end"
    }

    subgraph cluster_main_flow
    {
        label="Share Same Skeleton Animation"
        "Setup the rig relationship" ->
        "Pick the target skeleton Animation: 'Idle_Rifle_Hip_Break1'" ->
        "Duplicate Asset and Retarget" ->
        "set 'Mixamo' skeleton as target" ->
        "'Select' to confirm"
        node [style=bold]
        "'Select' to confirm" -> "end"
    }
    "Setup the rig relationship" -> "Are both skeletons the same?" [dir=none lhead=cluster_setup_the_rig_relationship]
    "Pick 'UE4 Humanoid' skeleton" -> "Pick 'Humanoid Rig'" [dir=none lhead=cluster_setup_humanoid_rig]
    "Pick 'Mixamo' skeleton" -> "Pick 'Humanoid Rig'" [dir=none lhead=cluster_setup_humanoid_rig]
}

I placed 2 'end' nodes in cluster_setup_the_rig_relationship and cluster_main_flow subgraph. How can I separate 2 'end' nodes by subgraph from connected by DOT ? Or is there other way to express the same concept?


Solution

  • You use for the nodes in both cases the name and this is taken as node identifier as well. By giving separate identifiers you can solve this issue, I used emf and ere as identifiers and set the appropriate label:

    digraph anim_retargetting
    {
        layout=dot
        compound=true
        fontname="Verdana"
        subgraph cluster_concept {
            style=filled
            color=lightgrey
            label = "Concept"
    
            edge [label=" needs"]
            node [shape=Msquare]
            "share skeleton animation" -> "same skeleton asset" -> "same skeleton"
        }
    
        subgraph cluster_setup_humanoid_rig
        {
            style=filled
            color=lightgrey
            label="Setup 'Humanoid Rig'"
            "Pick 'Humanoid Rig'"
    
            node [style=bold]
            "Pick 'Humanoid Rig'" -> "Mapping bones with Skeleton and Rig."
        }
        subgraph cluster_setup_the_rig_relationship
        {
            style=filled
            color=lightgrey
            label="Setup the rig relationship"
            "Are both skeletons the same?" -> "Yes"
            "Are both skeletons the same?" -> "No" ->
            "Pick 'UE4 Humanoid' skeleton" -> "Pick 'Mixamo' skeleton"
    
            node [style=bold]
            ere[label="end"]
            "Yes" -> ere
            "Pick 'Mixamo' skeleton" -> ere
        }
    
        subgraph cluster_main_flow
        {
            label="Share Same Skeleton Animation"
            "Setup the rig relationship" ->
            "Pick the target skeleton Animation: 'Idle_Rifle_Hip_Break1'" ->
            "Duplicate Asset and Retarget" ->
            "set 'Mixamo' skeleton as target" ->
            "'Select' to confirm"
            node [style=bold]
            emf[label="end"]
            "'Select' to confirm" -> emf
        }
        "Setup the rig relationship" -> "Are both skeletons the same?" [dir=none lhead=cluster_setup_the_rig_relationship]
        "Pick 'UE4 Humanoid' skeleton" -> "Pick 'Humanoid Rig'" [dir=none lhead=cluster_setup_humanoid_rig]
        "Pick 'Mixamo' skeleton" -> "Pick 'Humanoid Rig'" [dir=none lhead=cluster_setup_humanoid_rig]
    }