Code Monkey home page Code Monkey logo

Comments (6)

GoogleCodeExporter avatar GoogleCodeExporter commented on May 18, 2024

It will parse it ( in the latest tests it already does )

PS: The code is shaping up. It's taking forever to release the updated pydot
because I embarked on rewriting pydot's core aiming at increasing performance and supporting some advanced constructs/expressions that weren't supported before. And that took a bit of thinking plus extensive regression tests. It will eventually see the light of day.

Original comment by [email protected] on 21 Jan 2008 at 1:59

from pydot.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 18, 2024

Sorry it's my mistake, it parses comma not in same way as graphviz. But seems
that specification doesn't allow comma here. So following works:

a -> {b c}
a -> {b; c}

Sorry for the noise.

Original comment by [email protected] on 22 Jan 2008 at 6:48

from pydot.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 18, 2024

Well, I'm here again :)

There are problems with parsing other way around:

{b; c} -> a

Error is:

TypeError: unsupported operand type(s) for +: 'Subgraph' and 'str'

BTW, I've not found any unittests here. Is this something you do in private
repository? I'd like to help with tests and maybe some code (although I'm not
familiar with pyparsing yet).

Original comment by [email protected] on 28 Jan 2008 at 7:39

from pydot.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 18, 2024

Same with:

a -> b -> {c; d}

Original comment by [email protected] on 28 Jan 2008 at 7:50

from pydot.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 18, 2024

All of those cases should be fixed in the ucoming 1.0.2. I've given the parsing code a good update.

Regarding the unittests, I've put some together for this latest version. I don't think I'll include them in the main release (loads of .dot files) but let me know if you want them.

Original comment by [email protected] on 14 Feb 2008 at 10:06

  • Changed state: fixed

from pydot.

peternowee avatar peternowee commented on May 18, 2024

Of all the examples given in this thread, the only one I am still seeing a problem with is this one:

digraph G{
    a -> b -> {c; d}
}

Expected result, as when loaded directly by Graphviz:
mre81_pncp037_pydot-pydot-4 dot pdt-before-fix-gv

Actual result when first parsed by pydot, then sent to Graphviz:
mre81_pncp037_pydot-pydot-4 dot pdt-before-fix-pd-gv

The pydot parser only returns a -> b:

> dot_parser.py(548)parse_dot_data()
-> tokens = graphparser.parseString(s)
(Pdb) n
> dot_parser.py(549)parse_dot_data()
-> return list(tokens)
(Pdb) pp tokens
([<pydot.Dot object at 0x7f5b49cfaf98>], {})
(Pdb) pp tokens[0].obj_dict
{'attributes': {},
 'current_child_sequence': 2,
 'edges': {('a', 'b'): [{'attributes': {},
                         'parent_edge_list': None,
                         'parent_graph': <pydot.Dot object at 0x7f5b49cfaf98>,
                         'points': ('a', 'b'),
                         'sequence': 1,
                         'type': 'edge'}]},
 'name': 'G',
 'nodes': {},
 'parent_graph': <pydot.Dot object at 0x7f5b49cfaf98>,
 'simplify': False,
 'strict': False,
 'subgraphs': {},
 'suppress_disconnected': False,
 'type': 'digraph'}

However, a graph with a -> b -> c gets correctly parsed as a -> b; b -> c;. And a graph with a -> {b; c} also gets correctly parsed as a -> subgraph { b; c; } as well. It is just the mix of these two that does not work.

It is not easy to debug the parsing by stepping through the code. Instead, PyParsing has some special debugging functions. I do not know when I will get around to that, so anyone else feel free to pick this up.

Versions: pydot 1.4.1, pyparsing 2.4.7, python 3.7.3.

from pydot.

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.