How to use id for two different nodes with the same name

Hi everyone, I have the following issue: I'm making a tree graph in which some of different nodes have the same name (e.g. West (Mande) and West (Dogon)). Unfortunately, the documentation doesn't give an example of how to use the id attribute to create two unique nodes which would be displayed under the same name. Here's my graph: digraph "African Languages" { graph [rankdir = "LR", splines=ortho, concentrate=true, nodesep=0.01, ranksep=0.2]; ratio=auto; node [shape=none, height=0.02]; edge [dir = none]; "Niger-Congo"; Kordofanian [fontcolor=darkolivegreen3]; Talodi [fontcolor=darkolivegreen3]; Rashad [fontcolor=darkolivegreen3]; Heiban [fontcolor=darkolivegreen3]; Katla [fontcolor=darkolivegreen3]; Atlantic [fontcolor=darkslategray3]; North [fontcolor=darkslategray3]; Bijago [fontcolor=darkslategray3]; South [fontcolor=darkslategray3]; Ijoid [fontcolor=deepskyblue3]; Defaka [fontcolor=deepskyblue3]; "East Ijo" [fontcolor=deepskyblue3]; "West Ijo" [fontcolor=deepskyblue3]; East [fontcolor=blue]; Mande [fontcolor=blue]; West [fontcolor=blue]; "Central/Southwest" [fontcolor=blue]; Northwest [fontcolor=blue]; "Niger-Congo" -> Kordofanian [color=darkolivegreen3]; "Niger-Congo" -> Atlantic [color=darkslategray3]; "Niger-Congo" -> Mande [color=blue]; "Niger-Congo" -> Ijoid [color=deepskyblue3]; "Niger-Congo" -> Dogon; "Niger-Congo" -> "Volta-Congo"; Kordofanian -> Heiban [color=darkolivegreen3]; Kordofanian -> Talodi [color=darkolivegreen3]; Kordofanian -> Rashad [color=darkolivegreen3]; Kordofanian -> Katla [color=darkolivegreen3]; Atlantic -> North [color=darkslategray3]; Atlantic -> Bijago [color=darkslategray3]; Atlantic -> South [color=darkslategray3]; Mande -> West -> Northwest [color=blue]; Mande -> West -> "Central/Southwest" [color=blue]; Mande -> East [color=blue]; Ijoid -> Defaka [color=deepskyblue3]; Ijoid -> "East Ijo" [color=deepskyblue3]; Ijoid -> "West Ijo" [color=deepskyblue3]; Dogon -> Plain; Dogon -> Escarpment; Dogon -> West; Dogon -> "Northwest"; Dogon -> "North Plateau"; Dogon -> "Yanda dom"; Dogon -> "Oru yille"; Dogon -> "Naya tegu"; } On the diagram, there should be two nodes with the name "West" (one under Mande and one under Dogon), and two nodes labeled "Northwest". What do I need to change to achieve that? Thanks a lot! Anna
graph1.png49.15 KB

The "name" of each node must

The "name" of each node must be different, but the "label" can be the same.

For example:

     digraph{a [label="node"]; b [label="node"]; a->b}


This I've found can be

This I've found can be rewritten as a single command

digraph{{a [label="node"]}->{b [label="node"]}};

You can also write it

You can also write it as

digraph{{node[label="node"] a ->b}}

Thanks a lot! This was

Thanks a lot! This was exactly what I needed. :)

Recent comments