Giter Club home page Giter Club logo

Comments (13)

pawamoy avatar pawamoy commented on August 23, 2024 1

Nice! It's working well, I got the same result for over 100 runs! This is great, thanks 🙂

from pydeps.

thebjorn avatar thebjorn commented on August 23, 2024 1

I've just release v1.9.1 which fixes this. Thanks for all the help.

from pydeps.

thebjorn avatar thebjorn commented on August 23, 2024

I can't reproduce that behavior. Which version of pydeps? Do you have a small testcase?

from pydeps.

pawamoy avatar pawamoy commented on August 23, 2024

pydeps v1.9.0!

I just ran this in pydeps own repository:

for i in 1 2 3 4 5; do
  pydeps pydeps --noshow --only pydeps -o pydeps.$i.svg
done

Here are the resulting SVGs thumbnails:

Screenshot_2020-04-30_20-25-27

As you can see they all slightly differ from each other 🙂

I found some information in dots manual page, though I'm not sure which applies:

(neato‐specific attributes)
...
start=val. Requests random initial placement and seeds the random number generator. If val is not an integer, the process ID or current time is used as the seed.

(fdp‐specific attributes)
...
start=val. Adjusts the random initial placement of nodes with no specified position. If val is is an integer, it is used as the seed for the random number generator. If val is not an integer, a random system‐generated integer, such as the process ID or current time, is used as the seed.

If one of those start value applies, maybe we could get a deterministic output if we used the same seed each time?

from pydeps.

thebjorn avatar thebjorn commented on August 23, 2024

Interesting, they're all exactly the same on Windows (and on WSL).

I used this, which should be similar:

python -c "import os;[os.system('pydeps pydeps --noshow --only pydeps -o pydeps.{}.svg'.format(i)) for i in range(5)]"

I'm afraid neither the neato nor the fdp layout engines are relevant since pydeps is using the dot layout engine, but based on this tweet: https://twitter.com/Graphviz/status/1039632469782396929
a solution might be to change this line in the dot function in pydeps/pydeps/dot.py (L60), from:

cmd = "dot -T%s" % kw.pop('T', 'svg')

to

cmd = "dot -Gstart=1 -T%s" % kw.pop('T', 'svg')

since I can't reproduce the problem I'll need someone else to test it (..and perhaps create a PR?)

from pydeps.

pawamoy avatar pawamoy commented on August 23, 2024

I tried this option but it didn't work. I also tried -Gcenter=1, different layouts and combinations of option, but no luck, the resulting SVG is never quite the same.

My graphviz version is dot - graphviz version 2.44.0 (0), and I'm on ArchLinux.

from pydeps.

kinow avatar kinow commented on August 23, 2024

Never noticed the output was not deterministic. Tried the onliner above on a small (3 files) project from $work, and while the layout was the same, in a couple the oval shapes were misplaced.

Tried on Tornado, and the 5 images were different than each other. Tried the -Gstart change (modified the dot.py from my venv/lib/python/site-packages/...). First it failed to plot because of my typo (forgot the dash before Gstart). Then when I ran the second time it was still giving different layouts.

My env is Ubuntu LTS, Python Anaconda 3.7, dot - graphviz version 2.40.1 (20161225.0304).

from pydeps.

thebjorn avatar thebjorn commented on August 23, 2024

Hmm.. looks like this is a Python 3.x issue. I cannot reproduce with Py2.7 on any platform or graphviz configuration. Reproduced with Py3.6 + graphviz 2.40.1 on Ubuntu 18.04.4; and Py3.5 + graphviz 2.38.0 on Win10.

from pydeps.

thebjorn avatar thebjorn commented on August 23, 2024

Hmm.. the rule ordering in the dot file is also non-deterministic on Py3. We might get away with simply sorting the rules...?

from pydeps.

pawamoy avatar pawamoy commented on August 23, 2024

I'd be happy to try that out but I don't understand what you mean. By "rules" you mean the text input you feed to the dot command?

from pydeps.

thebjorn avatar thebjorn commented on August 23, 2024

@pawamoy I'm mostly just thinking out loudly - being able to reproduce the issue makes everything easier ;-) See the latest checkin (58bfcd7) for what I'm talking about. I'm pretty sure that if the dot source I generate is deterministic, then the resulting graphs will be as well. With the latest change we're almost there (some runs add a weight=5 to some relations that cause certain nodes to shift).

from pydeps.

greenled avatar greenled commented on August 23, 2024

@thebjorn somehow I'm getting this issue. Nodes get random order, and some times the amount of nodes are different. I'm using pydeps v1.10.22, Python 3.10.6, Graphviz 2.43.0 and Ubuntu 20.04.

from pydeps.

thebjorn avatar thebjorn commented on August 23, 2024

Hi @greenled , I can't reproduce this with py3.10.2, pydeps 1.10.22 and graphviz 2.50.0 on windows 11, running pydeps on pydeps source. Do you have a testcase?

from pydeps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.