travesty icon indicating copy to clipboard operation
travesty copied to clipboard

Generate names within the graph

Open atooni opened this issue 6 years ago • 5 comments

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

atooni avatar Nov 10 '18 20:11 atooni

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 :-).

mikolak-net avatar Nov 19 '18 21:11 mikolak-net

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 avatar Nov 20 '18 17:11 atooni

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.

atooni avatar Nov 20 '18 21:11 atooni

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

mikolak-net avatar Dec 06 '18 16:12 mikolak-net

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

atooni avatar Dec 07 '18 16:12 atooni