Javascript Union Pairs Union Find

I working on union finding. I want to group pairs of numbers based on whether one of the indices shares a number with an index of another pair. So: I have an array of pairs such as these: pairs: [[1,3], [6,8], [3,8], [2,7]] whats the best way to ...
more »

2017-07-26 01:07 (3) Answers

Shortest path with a twist

I have n vertices and m undirected weighted edges between them (weights are representing minutes). Each vertex contains a number of minutes required to drink a coffee on that vertex. I want to determine the shortest amount of time (minutes) neccess...
more »

2017-05-23 13:05 (3) Answers

Understanding Graph, Weighted method

Okay, so what does the SET stand for in the second line? Why is the second string in<>, ? public Weighted(In in, String delimiter) { st = new ST<String, SET<String>>(); while (!in.isEmpty()) { String line = in.readLi...
more »

2017-04-24 08:04 (1) Answers

Calculation of Dependent Values in Java

Using Java, I've got a source data set of integers, it's big but not huge - let's say it won't get bigger than 30,000 values. Using the source dataset I have some summary values I want to create (these are domain specific so not something you'll fin...
more »

2017-01-28 17:01 (1) Answers

Discarding incoming nodes in a directed graph

I'd like to discard incoming nodes in a directed graph. tl;dr (jump to section 3) I have a graph on which I perform a BFS to remove all unrelated nodes (relative to a candidate edge). 1. Sample graph data Let this be a graph data structure: Wher...
more »

2016-09-30 02:09 (1) Answers