Skip to main content

All Questions

6 votes
1 answer
444 views

Add an edge to a graph to minimize the average shortest path length

This program is used to find the nodes in a grid network, between which, if an edge is added, the average shortest path length of the entire grid reduces by the most. "Average shortest path length" ...
Akshay M's user avatar
3 votes
1 answer
180 views

Shortest code to generate a full mesh of elements

I am trying to find the shortest code that generates a full mesh of the elements fed into it in graphviz format e.g. the full mesh of [0, 1, 2] is: 2 -> 0 ...
Mark Omo's user avatar
  • 449
20 votes
1 answer
302 views

Rainfall - August 2016 Community Challenge (Hooray for graphs!)

A solution for the August 2016 Community Challenge (Rainfall). I've intentionally left out error checking on the file formatting. This seems like a very obvious graph problem to me - we want to ...
Dan Oberlam's user avatar
  • 8,064
13 votes
1 answer
177 views

Create edges from cells

I have a (large) number of nodes and (triangular) cells, e.g., cells_nodes = [ [0, 3, 1], [0, 2, 3] ] This example represents the small mesh (Please ...
Nico Schlömer's user avatar
5 votes
1 answer
2k views

Strongly connected components algorithm

In my Python application, I am using Tarjan's algorithm to compute strongly connected components. Unfortunately, it shows up under profiling as one of the top functions in my application (at least ...
Antimony's user avatar
  • 211