Post Reply 
minimum spanning tree lua HPPL
10-28-2021, 08:34 PM
Post: #7
RE: minimum spanning tree lua HPPL
(10-28-2021 05:04 PM)robmio Wrote:  However, I modified my code (see below), modifying the "same" statement ...

No ! OP post were correct ! (except for minor leaking of variables, jj in same())

It was your inputs that were wrong.
Each point has 2 numbers, Edge have 2 points, thus 4 numbers.
Remember, each edge contains 4 values.

pts0 := [ [3,4.5], [1,5], ..., ,[5,2]]; /* 12 points */
edgs0 := [ [3,4.5 , 1,5], [3,4.5 , 5,6.5], ..., [4.5,0.5 , 5,2]]; /* 66 edges */

Running OP code, on my laptop, it finished in 0.273 sec, return these line segments.
(for comparison, my complex-number as points 2nd version, it finished in 0.006 sec)

CAS> mstRob(pts0, edgs0)
{{2.5,5,3,4.5},
{1,5,2.5,5},
{4,2.5,3,4.5},
{5,2,4,2.5},
{4.5,0.5,5,2},
{2,2,4,2.5},
{1.5,1,2,2},
{7,3,5,2},
{8,4,7,3},
{5,6.5,3,4.5},
{3,9,5,6.5}}
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
minimum spanning tree lua HPPL - robmio - 10-28-2021, 01:04 PM
RE: minimum spanning tree lua HPPL - Albert Chan - 10-28-2021 08:34 PM



User(s) browsing this thread: 1 Guest(s)