Skip to content
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

Incorrect node ID if its name starts with Number #96

Open
NickRimer03 opened this issue Nov 23, 2018 · 2 comments
Open

Incorrect node ID if its name starts with Number #96

NickRimer03 opened this issue Nov 23, 2018 · 2 comments

Comments

@NickRimer03
Copy link

NickRimer03 commented Nov 23, 2018

Hi!
This is an issue example:

const dotStr = "graph g { a--b; a--c; a--d; a--1f; }";
const g = graphlibDot.read(dotStr);
console.log(g.children());

And this is the result:
["1", "a", "b", "c", "d", "f"]
Five nodes ("a", "b", "c", "d", "1f") expected. Six nodes we have ("1f" transforms to "1" and "f").
If we draw this graph we'll see that node "a" will be connected to node "1" and node "f" will be in the air (disconnected graph).

Another example. If dot-string will be like this: const dotStr = "graph g { a--b; a--c; a--d; a--1b; a--1c; }"; the result is: ["1", "a", "b", "c", "d"].
Six nodes expected ("a", "b", "c", "d", "1b", "1c"). Five nodes we have ("1b" transforms to "1" and "b", "1c" transforms to "1" and "c" and then all "1" merges into one "1", also "b" and "c").

This behavior is critically incorrect for me because of random string-number node IDs in project. Luckily all of them may starts with letter - and all is OK. But if there is a number on the first place in ID - all crashes.

I hope you'll fix it or help me to find any ways to fix this behavior.

@NickRimer03
Copy link
Author

NickRimer03 commented Nov 23, 2018

The only way I found for now is to parse DOT by myself and to create graph like this:

const dotStr = "graph g { a--b; a--c; a--d; a--1f; }";
const g = new Graph({ directed: false, multigraph: true, compound: true });
g.setNode("a", "");
g.setNode("b", "");
g.setNode("c", "");
g.setNode("d", "");
g.setNode("1f", "");
g.setEdge("a", "b", "");
g.setEdge("a", "c", "");
g.setEdge("a", "d", "");
g.setEdge("a", "1f", "");

Result: ["a", "b", "c", "d", "1f"]

But it's not the way I wanted. Just wanna the original parser to work as expected.

UPD: of course another way is to force push random letter at the beginning of any of my IDs. But it is not the way my project lead wants :(

@NickRimer03
Copy link
Author

NickRimer03 commented Mar 7, 2019

Ok, it 2+ months pass, but is it too hard to answer even a word? Just a simple "this is not a problem at all, this is only your local problem, 4uk off yourself, suffer and deal with it".
Freaking easy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant