Code Snippet
Shortest distance between surface points (Python) One way to find the shortest distance between a series of surface (x, y) points is to let Python module itertools find the non-repeating combinations of point pairs. Now you can apply the Pythagoras' theorem to find all the distances and the minimum distance. |
+3 forum
2 | ||

i have a project that it find the shortest bakery in c# . i written a program that save vertex and edge and drowing when opening the program. bu i need a code that find the nearest bakery. please write the needing code below this. i have this vertex.id vertex.x, vertex.y and edge its loaded this Edge edge = edges.ElementAt(i);// get verr please help me |
+0 forum
1 | ||

i have to create a graph for my project i found an example that was working and followed it first time with graph. i wrote my code got no errors but when i run the code this is what i am getting i don't understand it can some one help me please i am in crunch mode. Exception in thread "main" java.lang.NullPointerException at Main.GetAllAdjcentNodes(Main.java:69) at Main.Dijkstras(Main.java:101) at Main.main(Main.java:184) here is the code import java.util.ArrayList; import java.util.HashMap; import java.util.ArrayDeque; public class Main { public static ArrayList<node> Nodes = new ArrayList<node>(); public static HashMap<String,Integer> NodesIndex = new HashMap<String,Integer>(); public static ArrayList<edge> Edges … |
+0 forum
8 | ||

Sorry for my english.. Im trying to make a program that show the shortest route of this nodes using BFS algorithm.. ![115](/attachments/large/3/115.JPG "115") i tried to print the prev array which shows the shortest route but somehow it doesnt appear on console when running.. how to fix it? btw, is there any much simple algorithm than these one? thanks. > #include <stdio.h> > #include <queue> > #include <conio.h> > using namespace std; > > int nodes, edges, src, dest; > int graph[100][100], color[100],distance[100],prev[100]; > const int WHITE = 0; > const int GRAY = 1; > const int BLACK = … |
+0 forum
4 | ||

Hello I am supposed to find a bunch of different statistics from a text file for a homework assignment. I have found everything except the shortest line that is not a blank line. Can someone help me solve this problem? Thanks [CODE] def stats(): linecount = 0 blankline = 0 largeline = '' largelinelen = 0 linelength = 0 nonemptyline = 0 shortline = '' shortlinelen = largelinelen inFileName = input("Please enter the name of the file to copy: ") inFile = open(inFileName) for line in inFile: linecount = linecount + 1 linelength = linelength + len(line) if line.startswith('\n'): blankline … |
+0 forum
3 | ||

Problem: solve the following Source of SHORTEST DISTANCE path of A,B,C,D,E,F,G. I already did link the strings of dots of ABCDEFG and made a polygon which is the other objectives, my only problem now is calculating the source of the shortest distance part of A,B,C,D,E,F,G. Am using net beans. Guys can you please help me? am very much confused. /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author User */ public class paths{ } import java.awt.Color; import java.awt.Graphics; import java.swing.*; public class paths { private static … |
+0 forum
7 | ||

I have made floyd warshall algorithm. I need some help for finding shortest path from source to destination. We have to give source and destination. Eg. Program gives us output like source=A and destination=D then shortest path is A-B-D with distance 10. I also give the code for that in which we are calculating shortest path from all node to other node. Waiting for your reply. Thank you. --------------------------- Floyd warshall.cpp [CODE]#include <stdio.h> #include<conio.h> int n; int dist[16][16]; void printDist() { int i, j; printf(" "); for (i = 0; i < n; ++i) printf("%4c", 'A' + i); printf("\n"); for … |
+0 forum
1 |

The End.