Re: [Jprogramming] determine the cycle

2016-08-25 Thread Raul Miller
half Of Raul Miller >> Sent: donderdag 25 augustus 2016 23:21 >> To: Programming forum >> Subject: Re: [Jprogramming] determine the cycle >> >> I am more than willing to believe that I have been careless and made a >> mistake. I'm actually pretty talented at makin

Re: [Jprogramming] determine the cycle

2016-08-25 Thread R.E. Boss
> R.E. Boss > > > > > >> -Original Message- > >> From: Programming [mailto:programming- > boun...@forums.jsoftware.com] > >> On Behalf Of Raul Miller > >> Sent: donderdag 25 augustus 2016 15:36 > >> To: Programming f

Re: [Jprogramming] determine the cycle

2016-08-25 Thread Raul Miller
;>> ;{.(3 :('''x y''=.y'; '(y-.t{y);~ x,({:x)-.~y{~t=.1 i.~ y e.~"1 >>> {:x'))^:(#@>@{:) ({.;}.) edges >>> 1 2 4 5 6 7 8 9 10 11 12 13 24 25 26 23 16 15 14 22 21 20 19 18 17 3 1 >>> >>> >>>

Re: [Jprogramming] determine the cycle

2016-08-25 Thread Louis de Forcrand
ogramming-boun...@forums.jsoftware.com] >> On Behalf Of Raul Miller >> Sent: donderdag 25 augustus 2016 15:36 >> To: Programming forum >> Subject: Re: [Jprogramming] determine the cycle >> >> Oops, I represented the vertices incorrectly ({."1 would only be

Re: [Jprogramming] determine the cycle

2016-08-25 Thread Louis de Forcrand
;@{:) ({.;}.) edges >> 1 2 4 5 6 7 8 9 10 11 12 13 24 25 26 23 16 15 14 22 21 20 19 18 17 3 1 >> >> >> R.E. Boss >> >> >>> -Original Message----- >>> From: Programming [mailto:programming-boun...@forums.jsoftware.com] >>> On Behalf Of Ra

Re: [Jprogramming] determine the cycle

2016-08-25 Thread Raul Miller
traversed in the order they are encountered. >> >> Thanks, >> >> -- >> Raul >> >> >> On Thu, Aug 25, 2016 at 8:36 AM, 'Jon Hough' via Programming >> wrote: >> > Raul, >> > >> > your solution seems to miss out

Re: [Jprogramming] determine the cycle

2016-08-25 Thread R.E. Boss
2 4 5 6 7 8 9 10 11 12 13 24 25 26 23 16 15 14 22 21 20 19 18 17 3 1 R.E. Boss > -Original Message- > From: Programming [mailto:programming-boun...@forums.jsoftware.com] > On Behalf Of Raul Miller > Sent: donderdag 25 augustus 2016 15:36 > To: Programming forum > Subje

Re: [Jprogramming] determine the cycle

2016-08-25 Thread Roger Shepherd
Pardon the interruption, but are you taking advantage of the well known depth first search, rooted tree growing search that produces a complete basis for all cycles in a connected graph? From there you can go on to various exchange system (matroids) if you've a mind to. There's a lot of work done a

Re: [Jprogramming] determine the cycle

2016-08-25 Thread Raul Miller
t some vertices and duplicates others. > > > > On Thu, 8/25/16, Raul Miller wrote: > > Subject: Re: [Jprogramming] determine the cycle > To: "Programming forum" > Date: Thursday, August 25, 2016, 9:07 PM > > Best I can come up with > is > >

Re: [Jprogramming] determine the cycle

2016-08-25 Thread 'Jon Hough' via Programming
By the way, this does not seem to be a cycle in the original graph. On Thu, 8/25/16, Louis de Forcrand wrote: Subject: Re: [Jprogramming] determine the cycle To: programm...@jsoftware.com Date: Thursday, August 25, 2016, 10:26 PM I was just wonderi

Re: [Jprogramming] determine the cycle

2016-08-25 Thread Louis de Forcrand
gt; Sent: donderdag 25 augustus 2016 13:23 >> To: Programming forum >> Subject: Re: [Jprogramming] determine the cycle >> >> That is not a cycle. >> >> (1+i.26) -. {."1 edges >> 8 19 24 >> >> -- >> Raul >> >> >>

Re: [Jprogramming] determine the cycle

2016-08-25 Thread Louis de Forcrand
As usual, a minor typo: Since cl finds only the shortest cycles (which are all the same length), I added and >@ to the first {:”1. That’s why the result is unboxed. However cls deliberately doesn’t have this, as its results may be of different lengths. Here they are again in case I copied the wr

Re: [Jprogramming] determine the cycle

2016-08-25 Thread 'Jon Hough' via Programming
Raul, your solution seems to miss out some vertices and duplicates others. On Thu, 8/25/16, Raul Miller wrote: Subject: Re: [Jprogramming] determine the cycle To: "Programming forum" Date: Thursday, August 25, 2016, 9:07 PM Best

Re: [Jprogramming] determine the cycle

2016-08-25 Thread Louis de Forcrand
Got this: cl=: [: {:"1 ] ([: ; lp&.>/"1)@]^:(*./@:~: {:@>@{:"1)^:_ lp lp=: [ ((-. (,: |.)@(_2&{.)) ; ])"2 1 ] ,"1 0 {:"1@[ {~ {:@] I.@:= {."1@[ Not particularly elegant or concise, but it works (G -: edges): ((, |."1) G) cl 1 1 2 4 5 6 7 8 9 10 11 12 13

Re: [Jprogramming] determine the cycle

2016-08-25 Thread Raul Miller
Best I can come up with is {."1 ((] , -. {~ {.@I.@(-. +./"1@e. {:@]))^:(<:@#@[) ,:@{.) edges 1 3 17 18 18 20 20 21 22 14 15 16 23 26 25 13 12 11 11 10 9 7 6 5 4 2 Change {.@I. to {:@I. if you want things in the other order. -- Raul

Re: [Jprogramming] determine the cycle

2016-08-25 Thread R.E. Boss
programming-boun...@forums.jsoftware.com] > On Behalf Of Raul Miller > Sent: donderdag 25 augustus 2016 13:23 > To: Programming forum > Subject: Re: [Jprogramming] determine the cycle > > That is not a cycle. > >(1+i.26) -. {."1 edges > 8 19 24 > > -- >

Re: [Jprogramming] determine the cycle

2016-08-25 Thread Raul Miller
That is not a cycle. (1+i.26) -. {."1 edges 8 19 24 -- Raul On Thu, Aug 25, 2016 at 6:13 AM, R.E. Boss wrote: > Given the edges in a graph which is a cycle, like >edges > 1 2 > 3 1 > 2 4 > 4 5 > 5 6 > 6 7 > 7 8 > 9 8 > 10 9 > 11 10 > 11 12 > 12 13 > 14 15 > 15 16 > 17

[Jprogramming] determine the cycle

2016-08-25 Thread R.E. Boss
Given the edges in a graph which is a cycle, like edges 1 2 3 1 2 4 4 5 5 6 6 7 7 8 9 8 10 9 11 10 11 12 12 13 14 15 15 16 17 3 18 17 18 19 20 19 20 21 21 22 22 14 16 23 13 24 25 24 26 25 23 26 Vertices of the graph are represented by >:i.26 Question is how to determine in an