Find the fewest line segments through 2D list of points
I am looking for a general software algorithm (preferably C#) to find the minimum number of straight line segments from a 2 dimensional list (array) of points (doubles).
The algorithm shall return a list of line segment objects, each object comprised of all of the points along that segment, ordered by the direction we are traversing. The algorithm must also dynamically select the starting point, and determine the most efficient path through all points from the array.
This doesn't seem to be the "Traveling Salesman" scenario, since we are looking for straight lines (rather than a "spline" type of algorithm).
Examples of patterns are attached:
See also questions close to this topic

Show sorted Json data based on property
I have the following Data:
[ {Genre: "Classical", Artist: "Vince", Site: "www.vinny.uk"}, {Genre: "EDM", Artist: "Bart", Site: "www.barry.uk"}, {Genre: "Rock", Artist: "Judas", Site: "www.judy.uk"}, {Genre: "Rock", Artist: "Bran", Site: "www.branny.uk"}, {Genre: "EDM", Artist: "Tom", Site: "www.tommy.uk"} ]
I want to show the data in a layout, which looks as followed:
<div> <h1>Rock</h1> <a href="www.judy.uk"><h3>Judas</h3></a> <a href="www.branny.uk"><h3>Bran</h3></a> </div> <div> <h1>EDM</h1> <a href="www.barry.uk"><h3>Bart</h3></a> <a href="www.tommy.uk"><h3>Tom</h3></a> </div> <div> <h1>Classical</h1> <a href="www.vinny.uk"><h3>Vince</h3></a> </div>
One important note is that I can't edit the Data. I'm using JQuery btw.
Is it possible to loop the data so i dont have to type data[0].genre, data[1].genre etc for each genre?
How can I do that? Is it possible? Maybe it's an easy or unclear question but I'm very new to this.

.sort() acting weird with multiple arrays of text and numbers
I have been messing around with the .sort() and .concat() functions trying to combine multiple arrays of numbers and text into one and chronologically order it. It seems to work fine if only numbers are input into the array but as soon as there is text it seems to place it randomly, in this case between 6 and 7. Also, if I remove the number 3 from the array, the number 4 ends up out of order after the text, both being between 9 and 10. I have no idea why it is doing this if anyone could help.
With only numbers:
var multiArray = [[2, 8, 1, 7, 9], [6, 3, 5, 4, 10]]; // returns 1,10,2,3,4,5,6,7,8,9 document.write(multiArray[0] .concat(multiArray[1]) .sort() +"<br/>"); // returns 1,2,3,4,5,6,7,8,9,10 document.write(multiArray[0] .concat(multiArray[1]) .sort((a,b)=>ab) +"<br/>");
and with text
var multiArray = [[2, 8, 1, 7, 9], [6, 3, 5, "text", 4, 10]]; // returns 1,2,3,4,5,6,text,7,8,9,10 document.write(multiArray[0] .concat(multiArray[1]) .sort((a,b)=>ab) +"<br/>");
and without 3
var multiArray = [[2, 8, 1, 7, 9], [6, 5, "text", 4, 10]]; // returns 1,2,5,6,7,8,9,text,4,10 document.write(multiArray[0] .concat(multiArray[1]) .sort((a,b)=>ab) +"<br/>");

Algorithms for sorting schedules
I am writing a schedule organization code in Java. Specifications are as follows:
A college is looking for a way to organize their course schedule. In a single day, there are several hour long courses, which creates scheduling conflicts. Senior courses get priority in organization, then Junior courses, then Sophomore, then Freshmen (so if there were a scheduling conflict between a senior course and a sophomore class, the sophomore class would be moved). But the professor also wants to make sure that none of the courses are interfering with the required courses for each grade level (such as math courses, etc).
My idea is to organize it as such:
Standard courses: Required fields: name of course, the class rank(Sr, Jr,etc) , and the length of the course in minutes. These would be inputted first.
Required courses: Required fields: Name of course, class rank, when the course is scheduled. These would be inputted second.
Standard and required courses would be stored in respective ArrayLists.
The end goal would be to output every possible valid schedule combination where no conflicts are present. So the teacher would put in a list of courses, if the courses can't all fit then the lowest rank courses would be removed, and then the remaining courses would be organized in such a way that they all fit within the day (between 8 AM and 4 PM) in every possible configuration.
I am having trouble figuring out an algorithm to do such a process, any ideas?

How to compute the local clustering coefficient in dynamic networks in R?
I need something similar to local transitivity in igraph package but including the interval. I know tSna package calculates the graph transitivity, but I could not find any function to calculate transitivity at node level.
Thanks

dynamic inputs in Rshiny
I am trying to make reactive inputs to get an output and then use that output as input to calculate a function. This is just an example of what I want to do. I cannot remove the product function. Can you suggest how to display the output. so the product has to be a result from hours and maxdays which depends on the selection of days.
library(shiny) ui = fluidPage( selectInput('p_id','ID:', c(111,222,333)), uiOutput('uiID'), uiOutput('uiID1'), # uiOutput('val'), textOutput("values4.5"), submitButton("apply_changes") ) server = function(input, output, session) { maxdays < reactive({ if(input$p_id %in% c(111)){ x = c(1,2) }else{ if(input$p_id %in% c(222)){ x = 2 }else x = 3 } return(x) }) hours < reactive({ if(input$p_id %in% c(111)){ x = c(20,10) }else{ if(input$p_id %in% c(222)){ x = 20 }else x = 30 } return(x) }) output$uiID < renderUI({ selectInput('days','Days:', choices=maxdays()) }) output$uiID1 < renderUI({ selectInput('days','Days:', choices=hours()) }) product<function(p_id,maxdays,hours){ prod=p_id*maxdays*hours return(prod) } complete_ans <reactive({ answer < product(input$p_id,input$maxdays,input$hours) values4.5 = answer output=list(values4.5=values4.5) }) output$values4.5 < renderText({complete_ans()[['values4.5']]}) } runApp(shinyApp(ui = ui, server = server))

Keeping part of a path in Python
I'm new to python and I'm trying to keep part of the following: '/this/is/my/path' and I would like to keep this: '/my/path'
My problem is that the path is dynamic and the length is not the same all the times. And practically I would like to 'delete' the first two parts.
If I use this: os.getcwd().split("/")[2:5] my problem is that is not dynamic and also it converts it into a list that I do not want. Any ideas?

Highcharts  Add Point to chart with different color based on some condition dynamically
everyone ! I;m working on a Highchart where it appends values to the chart for every 5 seconds time. I'm adding points like this,
series.addPoint([(new Date()).getTime(), xnum(n.PointValue)], true, true);
When adding a point I want to add the point with a different color (RED) based on some other property. Can anyone help me to add the point with a different color ? Thanks

OpenLayer 4 draw arrows on map
I have a map with multiple points I want to draw arrows that point to these locations from the border of the map. How can one draw an arrow on a map that point to location?

C# Point3DCollection select point by min or max coordinate
I have Point3DCollection of hundreds of points like Point3D(2, 5, 8), Point3D(8, 6, 9), Point3D(5, 8, 12)... and I need to get coordinates of those which have lowest and highest X. I know how to find lowest value (using LINQ Min), but I don't know, how to find lowest value and get Y and Z of it. Can you please help me?