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

Parse default graph attributes #18

Open
cpettitt opened this issue Sep 30, 2014 · 3 comments
Open

Parse default graph attributes #18

cpettitt opened this issue Sep 30, 2014 · 3 comments

Comments

@cpettitt
Copy link
Collaborator

Currently rankdir doesn't get attached to the graph object in graphlib-dot, but it does with graphviz:

digraph {
    graph [rankdir=LR];

    X -> Y;
    Y -> X;
    Y -> Z;
    Z -> Y;
}
@HansvdLaan
Copy link

This doesn't seem to work for any graph attributes.

@webmaster128
Copy link

In https://github.com/dagrejs/graphlib-dot/blob/v0.6.4/lib/build-graph.js#L11, a missing graph: {} object causes the data to be lost in handleAttrStmt. However, I'm not sure how to merge the data from defaultStack into g.graph(), especially when it comes to subgraphs.


A workaround could be to use

digraph {
    rankdir=LR;

    X -> Y;
    Y -> X;
    Y -> Z;
    Z -> Y;
}

(demo), which is also used in some of the graphviz examples.

@metarmask
Copy link

Another workaround is to put quotes around the names:

digraph {
    "graph" [rankdir=LR]
}

becomes

digraph {
    graph [rankdir=LR]
}

This works for node and edge defaults too.

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

4 participants