Oh... right...

    ~., ((] , -. {~ {.@I.@(-. +./"1@e. {:@]))^:(<:@#@[) ,:@{.) |."1 edges
2 1 3 17 18 19 20 21 22 14 15 16 23 26 25 24 13 12 11 10 9 8 7 6 5 4

Or, closing the loop
    (,{.)~., ((] , -. {~ {.@I.@(-. +./"1@e. {:@]))^:(<:@#@[) ,:@{.) |."1 edges
2 1 3 17 18 19 20 21 22 14 15 16 23 26 25 24 13 12 11 10 9 8 7 6 5 4 2

Unfortunately, I would have to use a different approach for this code
to be robust on this issue. But, since I am already requiring a
variety of assumptions to hold true for the edges, I'm going to just
leave it like it is.

Thanks,

-- 
Raul


On Fri, Aug 26, 2016 at 1:26 AM, R.E. Boss <[email protected]> wrote:
> I share this talent: 2 is not adjacent to 3 was what I meant.
>
>
> R.E. Boss
>
>
>> -----Original Message-----
>> From: Programming [mailto:[email protected]]
>> On Behalf Of Raul Miller
>> Sent: donderdag 25 augustus 2016 23:21
>> To: Programming forum <[email protected]>
>> 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 making mistakes.
>>
>> That said, it looks to me as if 2 is adjacent to 4:
>>
>>    2{edges
>> 2 4
>>
>> Is there something about this that I am missing?
>>
>> Thanks,
>>
>> --
>> Raul
>>
>> On Thu, Aug 25, 2016 at 2:19 PM, R.E. Boss <[email protected]> wrote:
>> > You should swap the first two numbers of your solution, since 2 is not
>> adjacent to 4.
>> >
>> > It's more or less what I came up with, be it explicit.
>> >    ;{.(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
>> >
>> >
>> > R.E. Boss
>> >
>> >
>> >> -----Original Message-----
>> >> From: Programming [mailto:programming-
>> [email protected]]
>> >> On Behalf Of Raul Miller
>> >> Sent: donderdag 25 augustus 2016 15:36
>> >> To: Programming forum <[email protected]>
>> >> Subject: Re: [Jprogramming] determine the cycle
>> >>
>> >> Oops, I represented the vertices incorrectly ({."1 would only be
>> >> valid if the edges were directed).
>> >>
>> >> Here's a fix:
>> >>
>> >>    ~., ((] , -. {~ {.@I.@(-. +./"1@e. {:@]))^:(<:@#@[) ,:@{.) edges
>> >> 1 2 3 17 18 19 20 21 22 14 15 16 23 26 25 24 13 12 11 10 9 8 7 6 5 4
>> >>
>> >> This is the same core implementation, but this should show the actual
>> >> vertices being traversed in the order they are encountered.
>> >>
>> >> Thanks,
>> >>
>> >> --
>> >> Raul
>> >>
>> >>
>> >> On Thu, Aug 25, 2016 at 8:36 AM, 'Jon Hough' via Programming
>> >> <[email protected]> wrote:
>> >> > Raul,
>> >> >
>> >> > your solution seems to miss out some vertices and duplicates others.
>> >> >
>> >> >
>> >> > --------------------------------------------
>> >> > On Thu, 8/25/16, Raul Miller <[email protected]> wrote:
>> >> >
>> >> >  Subject: Re: [Jprogramming] determine the cycle
>> >> >  To: "Programming forum" <[email protected]>
>> >> >  Date: Thursday, August 25, 2016, 9:07 PM
>> >> >
>> >> >  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
>> >> >
>> >> > -------------------------------------------------------------------
>> >> > ---  For information about J forums see
>> >> http://www.jsoftware.com/forums.htm
>> >> > -------------------------------------------------------------------
>> >> > ---
>> >> > For information about J forums see
>> >> http://www.jsoftware.com/forums.htm
>> >> ---------------------------------------------------------------------
>> >> - For information about J forums see
>> >> http://www.jsoftware.com/forums.htm
>> > ----------------------------------------------------------------------
>> > For information about J forums see
>> http://www.jsoftware.com/forums.htm
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to