-
-
Notifications
You must be signed in to change notification settings - Fork 381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parsing DOT string with formatting in it #505
Comments
Hello, I'm just following up on this - is there any restriction on what version of DOT I can use? Or are certain DOT features not supported? I don't necessarily need the code updated, I just need to know what it can support so that I can work around the features that are not supported. |
It also looks like it does not support subgraphs:
|
Another gap: It also does not render "xlabels" on edges nor nodes. Looking at the old vis.js (which I believe this demo runs on), it seems to render that stuff no problem. Maybe there is some old code from there that you guys can use? |
Ping - just checking in on this |
Hi @s4m0r4m4, the DOT parser is old, definitely incomplete, not exactly specs compliant even where implemented and yeah, I can't rule out that it is indeed broken. Would you (@s4m0r4m4 or whoever is reading this) be willing to work on this? All the logic is neatly confined (not a single import/require statement) within https://github.com/visjs/vis-network/blob/master/lib/network/dotparser.js so not much insight into the library is needed (DOT string is the input and the output is directly supplied to |
Hi Thomassh, thanks for the message. I will have to see when this rises to the priority queue for me, it does sound nicely compartmentalized. Are you open to replacing most of that functionality with a separate lib (e.g. https://github.com/anvaka/dotparser/ or something similar)? |
Hi @s4m0r4m4, I'm a bit concerned about the maintenance status of Dotparser. The last commit is from March when the author just noticed it's 2020 and decided to update the year in the license, the last commit that actually changed something important is from January 2019 (I don't know, maybe it was perfect back then and the format didn't change at all?). Bigger issue is that it's based on PEG.js which is dead (though, in case of issues, we could fork it and maintain it as yet another Vis project as there doesn't seem to be a decent alternative). I'm not opposed to using a parser or even a dedicated DOT library for this (if there's a good one, it would be ideal actually), however it has to be done in treeshakable way as many people don't use DOT at all and this would be just bloat to them. Luckily, we just need a DOT string on input and an object, that can be passed to PS: The treeshakeability is mostly a note to myself, if you keep it contained within dotparser.ts and export a function from it, I'll rework the rest. PPS: How I imagine the API. import { Network, parseDOTNetwork } from "vis-network/standalone";
// The function parseDOTNetwork is available to be used.
new Network({}, parseDOTNetwork(myDOT)); import { Network } from "vis-network/standalone";
// The function parseDOTNetwork was not imported so Rollup/Webpack/whatnot can
// just throw it away with all of it's dependencies as if none of it ever even
// existed.
new Network(
{},
{
nodes: [
/* … */
],
edges: [
/* … */
],
}
); The following will be removed (it's already deprecated). import { Network } from "vis-network/standalone";
// The function parseDOTNetwork is used internaly and can't be treeshaken.
new Network({}, { dot: myDOT }); |
Hi, |
It also doesn't like comments. If I remove comments (//) it works. |
I've run into this as well while trying to render Graphviz from (my) Enola.dev RDF Graph Generation with Vis.js. (In my specific case, after finding and reading this issue, I'm going to "skip" this Dotparser and just "directly" turn my Things data structure into what Vis.js "natively" needs.) PS: If any maintainers are reading this, I would duplicate #1957 to this issue. |
Hello, I am using
vis.parseDOTNetwork(sTemp);
to parse this DOT-style string:The DOT string was created using scikit-learn's
sklearn.tree.export_graphviz(...)
(see https://scikit-learn.org/stable/modules/generated/sklearn.tree.export_graphviz.html#sklearn.tree.export_graphviz). I have verified that this is a valid DOT string using GraphViz Online.When I call
parseDOTNetwork
, it throws the following error: "Syntax error in part "<Intensity < 120 | Heigh..."
" from line 7283 of vis-network.js.It seems like vis-network is not set up to parse more complex labels with HTML formatting, but I could not find anything in the docs describing the limitations or workarounds. What do I need to do to be able to parse this DOT string?
Here are my versions from package-lock.json:
The text was updated successfully, but these errors were encountered: