Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

MST with Alteryx

Gottfried
7 - Meteor

Hello,

I am looking for a way to run a minimum-distance spanning tree algorithm in Alteryx. I would start with an input table listing all edges with 3 columns: [vertex 1], [vertex 2], [strength] (or distance or cost...). The goal would be to obtain the output table with the same format corresponding to the pruned optimal spanning tree (minimizing or maximizing the strength). I would then send it to the "Network Analysis Tool" to obtain a pretty force-graph.

 

A typical algorithm for that is "Prim's Algorithm" (https://en.wikipedia.org/wiki/Prim%27s_algorithm).

 

Does anyone see a way to perform this nicely directly within Alteryx? Would you agree to support the idea that this could be a great in-built option for an improved Network Analysis Tool?

 

Best regards,

Gottfried

 
4 REPLIES 4
afv2688
16 - Nebula
16 - Nebula

Hello @Gottfried,

 

Have you thought about writing the code in python or R? You could just implement the code in any of those two using the alteryx tools availabe for them.

 

It would be just a matter of configuring the input after that.

 

If you open any ot the prediction analysis tools you will see they are written in R.

 

Regards

Gottfried
7 - Meteor

Actually... I just did. I was reluctant to try and it was not a piece of cake as this is a first time for me and I know so little about R. But I could find a piece of code doing just MST on CRAN (https://rdrr.io/cran/edmcr/src/R/mst.R). After a few... no actually a long (!) range of trials and errors I could squeeze it into the R Tool in Alteryx.

 

It works!  😁😁👍

I had been so hard about how to get this done within Alteryx...

 

Thanks!

Gottfried

StephaneP
Alteryx
Alteryx

Hello,

 

As already posted on the French forum here is an iterative macro that apply the PRISM algorithm with the native Alteryx tool.

So if someone else is interested in this alternative full Alteryx solution, enjoy it 😊

StephaneP_3-1604780543380.png

I have added the ability to select if you want to maximize or minimize the strengh.

 

For everyone to easily test and understand how it works I have also added the basic workflow that the macro is launching for each iteration + some data examples at each iteration.

StephaneP_4-1604786528659.png

 

Enjoy !

 

Stéphane Portier
Sales Engineer
Alteryx
StephaneP
Alteryx
Alteryx

Following discussion with @Gottfried on the french community here is an update to the macro. The idea is to add an output with the Vertex list to facilitate integration with the Network analysis tool. Indeed, it really makes sense to combine them together.

StephaneP_1-1604939884243.png

 

@Gottfried, just to help other members of the english community to easily find topics about prism, as you have already done it on the French community, thank you to accept this post as a solution if you think it is relevant.

 

Enjoy !

 

Stéphane Portier
Sales Engineer
Alteryx
Labels