# Concentrate vs. labels

**URL:** <https://forum.graphviz.org/t/concentrate-vs-labels/2605>\
**Category:** Help\
**Created:** [December 13, 2024, 7:47pm UTC](https://forum.graphviz.org/t/concentrate-vs-labels/2605 "2024-12-13T19:47:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpanico](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@jpanico](https://forum.graphviz.org/u/jpanico)\
**Post date:** [December 13, 2024, 7:47pm UTC](https://forum.graphviz.org/t/concentrate-vs-labels/2605/1 "2024-12-13T19:47:42Z")

</div>

Can someone here help me understand the dot behavior that I’m seeing?

If I render this `digraph` using dot:

```auto
digraph "concentrate test" {
	graph [fontname=Arial rankdir=LR concentrate=true]
	node [fontname=Futura shape=Mrecord]
        subgraph "cluster_Concentrate test Sub 1" {
            graph [fontname=Arial rankdir=LR]
            node [fontname=Futura shape=Mrecord]
            AAA
            AAA -> b
            AAA -> c
            AAA -> d
            AAA -> e
            AAA -> g [label=“1”]
            1 -> b
        }
}

```

` dot -Tsvg concentrate_test.tree > concentrate_test.svg`

I get this (expected):  
 ![concentrate_test](https://global.discourse-cdn.com/graphviz/original/2X/5/524618c0479803813632c7e92c7f737be4486dd0.svg)

If I now remove the substring: ` [label=“1”]`, and render with the same command line, I get this (unexpected):

![concentrate_test_nolabel](https://global.discourse-cdn.com/graphviz/original/2X/8/812251c8865dfc23c07ae0a874b6a7b5fd598cf9.svg)

Why does removing the label break edge concentration?

thanks,

Joe

---

<div class="post-metadata">

**Author:** ![steveroush](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@steveroush](https://forum.graphviz.org/u/steveroush)\
**Post date:** [December 14, 2024, 12:13am UTC](https://forum.graphviz.org/t/concentrate-vs-labels/2605/2 "2024-12-14T00:13:39Z")

</div>

It is a bug. Maybe related to [this (closed) Issue](https://gitlab.com/graphviz/graphviz/-/issues/2559).  
I encourage you to report it [here](https://gitlab.com/graphviz/graphviz/-/issues/).  
Here is a workaround:

```auto
digraph "concentrate test" {
	graph [fontname=Arial rankdir=LR concentrate=true]
	node [fontname=Futura shape=Mrecord]
        subgraph "cluster_Concentrate test Sub 1" {
            graph [fontname=Arial rankdir=LR]
            node [fontname=Futura shape=Mrecord]
            AAA
            AAA -> b
            AAA -> c
            AAA -> d
            AAA -> e
            AAA -> g [label=" "]
            1 -> b
        }
}

```

Giving:

 ![cannotcentrate1](https://global.discourse-cdn.com/graphviz/original/2X/d/d2e3f3431c7f3b13e4cfd20e80da469fe147997d.png)

---

<div class="post-metadata">

**Author:** ![jpanico](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@jpanico](https://forum.graphviz.org/u/jpanico)\
**Post date:** [December 14, 2024, 12:40pm UTC](https://forum.graphviz.org/t/concentrate-vs-labels/2605/3 "2024-12-14T12:40:48Z")

</div>

Hi Steve,

Thanks for the workaround. But it only works for that one specific case. If I try to generalize that workaround by always adding empty labels to all edges, I still see the problem:

```auto
digraph "concentrate test" {
	graph [rankdir=LR concentrate=true]
    subgraph "cluster_Concentrate test Sub 1" {
        a
        b
        c
        d
        e
        f
        a -> b [label=" "]
        a -> c [label=" "]
        d -> e [label=" "]
        d -> f [label=" "]
    }
}

```

![concentrate_test](https://global.discourse-cdn.com/graphviz/original/2X/8/8b912286607a1130f81789f33e9c3b42b94743e4.svg)

---

<div class="post-metadata">

**Author:** ![jpanico](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@jpanico](https://forum.graphviz.org/u/jpanico)\
**Post date:** [December 14, 2024, 1:26pm UTC](https://forum.graphviz.org/t/concentrate-vs-labels/2605/4 "2024-12-14T13:26:42Z")

</div>

I have simplified the example:

[dot]  
digraph “concentrate test” {  
graph [rankdir=LR concentrate=true]  
a → b  
a → c  
}  
[/dot]

This is in graphviz version 12.1.2 (20240928.0832)

I’ve filed an issue here: [concentrate=true not working in 12.1.2 (20240928.0832) (#2627) · Issues · graphviz / graphviz · GitLab](https://gitlab.com/graphviz/graphviz/-/issues/2627)

---

<div class="post-metadata">

**Author:** ![steveroush](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@steveroush](https://forum.graphviz.org/u/steveroush)\
**Post date:** [December 14, 2024, 2:25pm UTC](https://forum.graphviz.org/t/concentrate-vs-labels/2605/5 "2024-12-14T14:25:00Z")

</div>

New workaround added **minlen** to increase spacing (lucky guess):

```auto
digraph "concentrate test" {
  graph [rankdir=LR concentrate=true]
  subgraph "cluster_Concentrate test Sub 1" {
    a
    b
    c
    d
    e
    f

    edge [minlen=2]
    a -> b [label="1"]
    a -> c [label="2"]
    d -> e [label=" "]
    d -> f [label=" "]
    g -> h 
    g -> i
  }
}

```

Giving:

 ![cannotcentrateA1](https://global.discourse-cdn.com/graphviz/original/2X/2/253ec9e332478b34287810e13f1f348efe341dd2.png)

---

<div class="post-metadata">

**Author:** ![smattr](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/smattr/32/85_2.png) [@smattr](https://forum.graphviz.org/u/smattr)\
**Post date:** [December 15, 2024, 4:41am UTC](https://forum.graphviz.org/t/concentrate-vs-labels/2605/6 "2024-12-15T04:41:37Z")

</div>

I am assuming it is unintentional your original input uses smart quotes? `label=“1”` will not work, whereas `label="1"` should.
