travesty
travesty copied to clipboard
Generate names within the graph
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
Hi, thanks for using travesty
!
At this point there are three ways to solve your problem:
- 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.
- Ditto for first using
toGraph
, manipulating that, and then generating the image. - 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:
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 :-).
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
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 : thanks for the update. Is it just me, or have you meant to attach something to the issue :)?
Sorry, I forgot. still some way to go as I had to finish a feature to be published soon. Here you go ....