from:https://www.cnblogs.com/wsine/p/5180778.html
运行环境
Pyhton3
numpy(科学计算包)
matplotlib(画图所需,不画图可不必)
计算过程
st=>start: 开始
e=>end: 结束
op1=>operation: 读入数据
cond=>condition: 是否还有未分类数据
op2=>operation: 找一未分类点扩散
op3=>operation: 输出结果
st->op1->op2->cond
cond(yes)->op2
cond(no)->op3->e
输入样例
/* 788points.txt */
15.55,28.65
14.9,27.55
14.45,28.35
14.15,28.8
13.75,28.05
13.35,28.45
13,29.15
13.45,27.5
13.6,26.5
12.8,27.35
12.4,27.85
12.3,28.4
12.2,28.65
13.4,25.1
12.95,25.95
788points.txt完整文件:下载
代码实现
# -*- coding: utf-8 -*-
__author__ = 'Wsine'
import numpy