# Edge weight not changing node position in neato?

**URL:** <https://forum.graphviz.org/t/edge-weight-not-changing-node-position-in-neato/700>\
**Category:** Help\
**Created:** [June 11, 2021, 3:05am UTC](https://forum.graphviz.org/t/edge-weight-not-changing-node-position-in-neato/700 "2021-06-11T03:05:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bestekov](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bestekov](https://forum.graphviz.org/u/bestekov)\
**Post date:** [June 11, 2021, 3:05am UTC](https://forum.graphviz.org/t/edge-weight-not-changing-node-position-in-neato/700/1 "2021-06-11T03:05:18Z")

</div>

I’m trying to use the [weight] attribute in a neato graph but changing the values does not appear to do anything?

Example file:

```auto
graph G {
  a -- b [weight="10.0"]
  a -- c [weight="1.0"]
  a -- d [weight="1000.1"]
  b -- c [weight="1"]
}

```

![test-graph](https://global.discourse-cdn.com/graphviz/original/1X/9a91772edb2302417d76da2f56267badb70e98ab.png)

I was expecting `a -- d` to be much closer together than the others, but it doesn’t seem to matter what values I put, the graph does not change at all.

I am on windows if that matters.

---

<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:** [June 11, 2021, 4:09am UTC](https://forum.graphviz.org/t/edge-weight-not-changing-node-position-in-neato/700/2 "2021-06-11T04:09:23Z")

</div>

If you want to get **d** closer to **a** , try the **len** attribute. **Weight** will just help enforce **len**

> … a larger weight encourages the layout to make the edge length closer to that specified by the [`len`](https://www.graphviz.org/doc/info/attrs.html#d:len) attribute.

---

<div class="post-metadata">

**Author:** ![bestekov](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bestekov](https://forum.graphviz.org/u/bestekov)\
**Post date:** [June 11, 2021, 1:27pm UTC](https://forum.graphviz.org/t/edge-weight-not-changing-node-position-in-neato/700/3 "2021-06-11T13:27:17Z")

</div>

I believe the default `len` attribute is `1.0` if not specified? Should I make len higher? Or make it bigger for the ones that should be farther apart?

This is just an example, my actual data is a social graph with like 100 nodes where I’ve calculated an edge-weight between nodes based on amount of interaction between the nodes. Should I be trying to programmatically generate different `len` values in _addition_ or _instead_?

I was hoping that I could just specify a weight attribute and then the force direction algorithm would just “figure it out” based on that attribute since the only initial information I have are the edges that exist between nodes and their weight I’m trying to use graphviz to draw and thereby better understand what the shape of the social graph _is_.

---

<div class="post-metadata">

**Author:** ![bestekov](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bestekov](https://forum.graphviz.org/u/bestekov)\
**Post date:** [June 11, 2021, 1:34pm UTC](https://forum.graphviz.org/t/edge-weight-not-changing-node-position-in-neato/700/4 "2021-06-11T13:34:02Z")

</div>

```auto
graph G {
  a -- b [weight="1.0" len=2]
  a -- c [weight="1.0" len=2]
  a -- d [weight="1" len=1]
  b -- c [weight="1" len=2]
}

```

If I set different `len` values, that seems to change the graph:  
 ![test-graph](https://global.discourse-cdn.com/graphviz/original/1X/bcccca0919e7e5cfa47bf10c9735da5265ef9230.png)

But setting a `weight` value still doesn’t seem to do anything. Whether the weight is 1 or 1000 the graph remains the same. Is that because it only matters when there are more nodes to try to lay out?

BTW, the CLI command I’m running is `neato -Tpng neato-test.gv -o test-graph.png`

---

<div class="post-metadata">

**Author:** ![bestekov](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bestekov](https://forum.graphviz.org/u/bestekov)\
**Post date:** [June 11, 2021, 3:27pm UTC](https://forum.graphviz.org/t/edge-weight-not-changing-node-position-in-neato/700/5 "2021-06-11T15:27:06Z")

</div>

I was able to generate a graph using real data that looked more reasonable by skipping the weight and just setting `len` inversely to weight (higher weight = smaller len) and that seemed to do the trick.
