The Floyd-Warshall Algorithm From Graph Theory, Applied to Parsing Molecular Structures

-

Hands-on explanations assisted by easy JavaScript code

The Floyd-Warshall algorithm is crucial in graph theory because it provides an efficient means to compute the shortest paths between all pairs of nodes in a graph. This classic dynamic programming algorithm is widely applicable beyond its traditional use in theoretical network evaluation. It really works by reading in a matrix that describes which pairs of nodes are connected by a single edge, and outputting the minimal variety of edges connecting every possible pair of nodes:

A set of nodes (red) linked by edges (light green lines) after which 2 examples of the distances (numbers of links between pairs of nodes, in dark green with dashed lines) calculated by the Floyd-Warshall algorithm. The direct links are encoded in a matrix called the “adjency matrix” whose elements are 1 (nodes linked) or 0 (not linked). The output from the algorithm if a matrix of equal size but containing the distances between all nodes because the minimal numbers of edges separating any two of them. This and all other figures were produced by the writer.

That is precious details about connectivity throughout the graph, that finds tons of applications; for instance in optimizing communication networks, analyzing contacts in social networks, or, as I’ll cover here, in parsing molecular structures — on the core of many tasks in cheminformatics and structural bioinformatics.

On this post I’ll show you the way the Floyd-Warshall algorithm may be employed to compute bond distances between atoms in a molecule, or said otherwise, the minimal variety of bonds separating every possible pair of atoms. Hopefully, my example won’t only showcase the algorithm’s application in chemistry but in addition encourage you to make use of it for other applications in…

ASK ANA

What are your thoughts on this topic?
Let us know in the comments below.

0 0 votes
Article Rating
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Share this article

Recent posts

0
Would love your thoughts, please comment.x
()
x