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

How to create an alternating sides daisy chain without templates? #209

Closed
hyphz opened this issue Dec 31, 2020 · 6 comments
Closed

How to create an alternating sides daisy chain without templates? #209

hyphz opened this issue Dec 31, 2020 · 6 comments

Comments

@hyphz
Copy link

hyphz commented Dec 31, 2020

The "alternating sides" daisy chain example also introduces a template syntax which is rather confusing as I'm not sure how to use one without the other. It seems to involve a "<<" member of the dict but it is not clear if this has to be on the connector, the wire, both, or what. Could the documentation on this be clarified?

@kvid
Copy link
Collaborator

kvid commented Dec 31, 2020

The "alternating sides" daisy chain example also introduces a template syntax which is rather confusing as I'm not sure how to use one without the other. It seems to involve a "<<" member of the dict but it is not clear if this has to be on the connector, the wire, both, or what. Could the documentation on this be clarified?

The documentation has a link to a page describing the anchor consept in general YAML files. I recommend reading that page. That consept is useful when several connectors or cables share a set of common attribute values.

@hyphz
Copy link
Author

hyphz commented Dec 31, 2020

That is very helpful for the template syntax, but it does not mention the details of the << signifier.

@kvid
Copy link
Collaborator

kvid commented Dec 31, 2020

That is very helpful for the template syntax, but it does not mention the details of the << signifier.

Please search for "Extend" in that same page, and you'll find several examples using << to inherit from a template and then extend with other attributes.

@hyphz
Copy link
Author

hyphz commented Jan 1, 2021

Thanks. That is helpful, but in that case, what causes the zig-zagging in the zig zag example to happen? Is it triggered by the use of templates?

@formatc1702
Copy link
Collaborator

formatc1702 commented Jan 1, 2021

Zig-zagging and templates are completely unrelated.


Regarding zig-zagging: Each individual connection set is interpreted as going from left to right.

Look at the source code for Example 06:

Since X1, X3 and X5 are on the left, and X2 and X4 are on the right, the connection sets are defined as follows (ignoring the cables in between):

X1 -> X2
X3 -> X2  (going "backwards" in the daisy chain, but following the required left-to-right syntax)
X3 -> X4
X5 -> X4  (same principle as above)
Expand for longer but potentially confusing answer

The GraphViz backend that WireViz relies on tries to keep the number of hierarchies/"columns" in which elements are arranged to a minimum.

  • The first set (X1 -> X2) generates one column for X1, one for the wire, and one for X2
  • The second set (X3 -> X2) realizes that X2 already exists, so it works backwards from there.
    • The wire goes in the existing column where the first wire lies
    • X3 goes in X1's existing column.
  • The third set realizes that X3 exists, so it works forwards from there
  • etc.

The actual arrangement of the nodes is handled by the GraphViz backend, so there might be cases where the visual output is not exactly what you expect, especially in more complex layouts. Unfortunately, currently there's not much WireViz can do about these cases.


Regarding templates, please note that these will not be required for most cases once #186 is finished and merged.

@hyphz
Copy link
Author

hyphz commented Jan 1, 2021

Thanks very much.

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

3 participants