from jhplot import *

http="https://datamelt.org/examples/data/"
print Web.get(http+"sample1_medusa.dat")

c=HMedusa()
c.loadFile("sample1_medusa.dat")
gg=c.getGraph()
c.visible()    # show the graph 

from medusa.georgios.ClusteringAlgorithms import KMeans2
num_of_clusters=6  # run k-means with 6 clusters 
kmeans = KMeans2(num_of_clusters, gg)
kmeans.runKMeans();
nodes_clusters=kmeans.getClusterMap()
print kmeans.getReport()

from medusa.georgios.Layouts import Layouts
Layouts.Apply_Kmeans_Clustering(gg, c.getPanel(), num_of_clusters) # asks for 6 clusters 
c.update()


