Re: [racket-users] Racket Generic Graph Library: non-numerical edge weight/labels + Graphviz?

2020-02-24 Thread unlimitedscolobb
Thank you very much for your answer Stephen!

I'll be busy the whole day tomorrow, but I'll come back in the evening most 
probably and will continue the discussion on the GitHub issue.

Indeed, I haven't seen the constructors actually check the edges to be 
numerical, but I had the impression that edge-weight had number? as the 
output contract:

  
https://docs.racket-lang.org/graph/index.html#%28def._%28%28lib._graph%2Fmain..rkt%29._edge-weight%29%29

You are right: allowing non-numerical edges should be a matter of replacing 
a couple ='s with equal? and maybe generalising a contract or two.

I'll also give you an example in the discussion on the GitHub issue, in 
about 24 hours.

-
Sergiu


On Monday, February 24, 2020 at 4:54:55 PM UTC+1, Stephen Chang wrote:
>
> > I am somewhat surprised that the graph library enforces numerical edge 
> weights at all. 
>
> The docs do informally say number weights but I don't think the 
> constructors do any checking? Any enforcement should be deferred to 
> individual algorithms. 
>
> Re: graphviz, I took a quick look and I think we could get the 
> behavior you want with a 1-line modification here, changing = to 
> equal? 
>
> https://github.com/stchang/graph/blob/master/graph-lib/graph/graph-fns-graphviz.rkt#L59-L60
>  
>
> Do you have an example I can work with? 
>
> I opened an issue so feel free to reply there instead: 
> https://github.com/stchang/graph/issues/53 
>
> On Sun, Feb 23, 2020 at 8:45 AM unlimitedscolobb 
> > wrote: 
> > 
> > Hello, 
> > 
> > I'm using the wonderful graph library which can do tons of various 
> graph-related tasks.  However, I haven't found a way to attach 
> non-numerical weights/labels to edges _and_ have them appear in the 
> Graphviz rendering of the graph. 
> > 
> > Is it at all possible? 
> > 
> > I did see define-edge-property, but properties defined in this way do 
> not appear in the Graphviz output.  I was looking for ways of passing edge 
> properties to the graphviz function of the library, but there don't seem to 
> be any. 
> > 
> > I am planning to do a pull request enhancing the graphviz function with 
> the possibility to include edge properties, but I wanted to ask around for 
> some solutions which may already exist. 
> > 
> > 
> > - 
> > Sergiu 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "Racket Users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to racket...@googlegroups.com . 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/e4cb44fd-0a21-4e91-a75c-f1442127bfa9%40googlegroups.com.
>  
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/955e7962-ee85-4548-a779-ba903b514d49%40googlegroups.com.


Re: [racket-users] Racket Generic Graph Library: non-numerical edge weight/labels + Graphviz?

2020-02-24 Thread Stephen Chang
> I am somewhat surprised that the graph library enforces numerical edge 
> weights at all.

The docs do informally say number weights but I don't think the
constructors do any checking? Any enforcement should be deferred to
individual algorithms.

Re: graphviz, I took a quick look and I think we could get the
behavior you want with a 1-line modification here, changing = to
equal?
https://github.com/stchang/graph/blob/master/graph-lib/graph/graph-fns-graphviz.rkt#L59-L60

Do you have an example I can work with?

I opened an issue so feel free to reply there instead:
https://github.com/stchang/graph/issues/53

On Sun, Feb 23, 2020 at 8:45 AM unlimitedscolobb
 wrote:
>
> Hello,
>
> I'm using the wonderful graph library which can do tons of various 
> graph-related tasks.  However, I haven't found a way to attach non-numerical 
> weights/labels to edges _and_ have them appear in the Graphviz rendering of 
> the graph.
>
> Is it at all possible?
>
> I did see define-edge-property, but properties defined in this way do not 
> appear in the Graphviz output.  I was looking for ways of passing edge 
> properties to the graphviz function of the library, but there don't seem to 
> be any.
>
> I am planning to do a pull request enhancing the graphviz function with the 
> possibility to include edge properties, but I wanted to ask around for some 
> solutions which may already exist.
>
>
> -
> Sergiu
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/e4cb44fd-0a21-4e91-a75c-f1442127bfa9%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAFfiA1LrcfpVxLW%2B%2BCkH0iwRrpzx4bG1t9eSMfFiRc%3D5VLG8MA%40mail.gmail.com.


[racket-users] Racket Generic Graph Library: non-numerical edge weight/labels + Graphviz?

2020-02-23 Thread unlimitedscolobb
Hello,

I'm using the wonderful graph library which can do tons of various 
graph-related tasks.  However, I haven't found a way to attach 
non-numerical weights/labels to edges _and_ have them appear in the 
Graphviz rendering of the graph.

Is it at all possible?

I did see define-edge-property, but properties defined in this way do not 
appear in the Graphviz output.  I was looking for ways of passing edge 
properties to the graphviz function of the library, but there don't seem to 
be any.

I am planning to do a pull request enhancing the graphviz function with the 
possibility to include edge properties, but I wanted to ask around for some 
solutions which may already exist.

On a different note, I am somewhat surprised that the graph library 
enforces numerical edge weights at all.  I understand that some algorithms 
don't work if edges are not numbers, but on the other hand they could just 
fail gracefully on non-numerical edges.  Anyway, my best solution as of now 
would be extending graphviz, as this update would require modifying less 
code.

-
Sergiu

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/e4cb44fd-0a21-4e91-a75c-f1442127bfa9%40googlegroups.com.