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

Generate names within the graph #7

Open
atooni opened this issue Nov 10, 2018 · 5 comments
Open

Generate names within the graph #7

atooni opened this issue Nov 10, 2018 · 5 comments

Comments

@atooni
Copy link

atooni commented Nov 10, 2018

Hello,

first of all thanks for sharing your work. I have pulled travesty into our project and ran some graphs through it. One question:

Is it possible to generate / inject names for the individual notes within the graph ?

I am attaching one of our graphs - I would like to have speaking names rather than map(x) etc.

Best regards
Andreas
dispatcher

@mikolak-net
Copy link
Owner

Hi, thanks for using travesty!

At this point there are three ways to solve your problem:

  1. A more roundabout one, but may be more efficient sometimes - if you have saved your representation as an SVG, you can freely manipulate the names as text.
  2. Ditto for first using toGraph, manipulating that, and then generating the image.
  3. The way it's actually intended, i.e. calling .named(name) on graph stages.

An example for the last one - this:

Source.single("t").named("beginning")
.map(_ + "a")
.to(Sink.ignore.named("end"))

Will render as:
naming example

I suppose this is not clear enough, so I'm adding the relevant section to the doc.

One more thing. I'm not entirely happy with this solution - it's quite cumbersome for "real-life" graphs, such as your example. So, if you have an ideas on a better way, I'm all ears :-).

@atooni
Copy link
Author

atooni commented Nov 20, 2018

Hi,

thanks for the answer. I think in my cases 1 & 2 are not really an option. My graphs are mostly generated from a lot of smaller components. I need to play with 3 and see what it feels like.

Once I gathered enough experience plaing with it I might have different ideas :)

Best regards
Andreas

@atooni
Copy link
Author

atooni commented Nov 20, 2018

Quick update: # 3 seems to work. I need too reiterate over the stream generators and make the names configurable to get meaningful output. I am attaching a sample with the most obvious names being set.

@mikolak-net
Copy link
Owner

@atooni : thanks for the update. Is it just me, or have you meant to attach something to the issue :)?

@atooni
Copy link
Author

atooni commented Dec 7, 2018

Sorry, I forgot. still some way to go as I had to finish a feature to be published soon. Here you go ....
dispatcher_core

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

2 participants