示例#1
0
func runOverallMaxCost(g *graph.Graph) {
	if !*maxCost {
		return
	}
	cost := 0
	highest, hcost := graph.ClusterID(""), 0
	lowest, lcost := graph.ClusterID(""), maxInt
	for _, c := range g.Clusters() {
		tmpcost := graph.MaxCost(g, c.ClusterID())
		cost += tmpcost
		if tmpcost > hcost {
			highest, hcost = c.ClusterID(), tmpcost
		}
		if tmpcost < lcost {
			lowest, lcost = c.ClusterID(), tmpcost
		}
	}

	fmt.Printf("    Average MaxCost: %v\n", float64(cost)/float64(g.NumClusters()))
	fmt.Printf("    Total MaxCost: %v\n", cost)
	fmt.Printf("    Cluster with highest MaxCost: %v (%v)\n", highest, hcost)
	fmt.Printf("    Cluster with lowest MaxCost: %v (%v)\n", lowest, lcost)
}
示例#2
0
func runMaxCost(g *graph.Graph, c *graph.Cluster) {
	if !*maxCost {
		return
	}
	fmt.Printf("    MaxCost: %v\n", graph.MaxCost(g, c.ClusterID()))
}