示例#1
0
文件: mine.go 项目: timtadh/sfp
func weight(u, v lattice.Node) (float64, error) {
	umax, err := u.Maximal()
	if err != nil {
		return 0, err
	}
	vmax, err := v.Maximal()
	if err != nil {
		return 0, err
	}
	udeg, err := u.AdjacentCount()
	if err != nil {
		return 0, err
	}
	vdeg, err := v.AdjacentCount()
	if err != nil {
		return 0, err
	}
	if umax && vmax {
		return 0, nil
	} else if !umax && vmax {
		return 1.0 / float64(vdeg), nil
	} else if umax && !vmax {
		return 1.0 / float64(udeg), nil
	} else {
		return 1.0, nil
	}
}
示例#2
0
文件: mine.go 项目: timtadh/sfp
func weight(u, v lattice.Node) (float64, error) {
	udeg, err := u.AdjacentCount()
	if err != nil {
		return 0, err
	}
	vdeg, err := v.AdjacentCount()
	if err != nil {
		return 0, err
	}
	return 2 * max(float64(udeg), float64(vdeg)), nil
}