# 剪不断、理还乱的债权债务关系，原来可以这样梳理！

2017/03/02 09:35

1、加载数据，并将数据经过修改字段名、节选指定字段、增加特定字段，使之符合无向图模型处理的数据格式要求。

sjz1 = @udf df0@sys by RS.load_s3 with (zx1129.db,select * from ajxx)

rename sjz1 as ("申请执行人":"source","被申请执行人":"target")

sjz2 = loc sjz1 by (source,target)

sjz2 = add value by (1)

2、对数据进行无向图模型处理，然后对指定的分析对象做无向图闭环分析，此处我们以“浙江鼎丰铝业有限公司”为例。

G = @udf sjz2 by GL.df2G

sjz3 = @udf G by GL.cycle_B with (浙江鼎丰铝业有限公司)

3、将上述数据中的所有列合并为一列，并去掉重复数据

sjz4 = @udf sjz3 by udf0.df_2one

sjz41 = distinct sjz4 by one

4、分别按照申请执行人和被申请执行人进行右连接操作，匹配出符合本次分析对象所在无向图闭环节点数据的诉讼信息，然后合并表数据，去掉重复项。

a = @udf sjz2,sjz41 by udf0.df_rjoin with (source,one)

a = @udf a by udf0.df_drop_col with one

b = @udf sjz2,sjz41 by udf0.df_rjoin with (target,one)

b = @udf b by udf0.df_drop_col with one

ss = union a,b

ss = distinct a by (source,target)

ss = @udfss by udf0.df_dropna

5、分离出本次分析对象所在无向图闭环节点，增加节点类别和节点大小字段。

node = loc ss by (source,target)

node = @udf node by udf0.df_2one

node = distinct node by (one)

node = add category by (1)

node = add size by (20)

node = @udf node by udf0.df_row_lambda with (x:2 if x[0]==u"@name" else x[1])

node = loc node by (one,lambda1,size)

rename node as ("one":"id","lambda1":"category")

6、将节点数据和三角债数据做自定义关系图函数的处理，得到符合关系图绘制格式的数据。

ss_v = @udf node,ss by VL.rgl2

store ss_v to ssdb by ssdb0 with ss_v

7、经过上述对数据的分析处理，就可以对得到的最终数据绘制三角债的关系图（力导向图），可以一目了然的看到与该公司发生债务关联的所有单位和个人，如下所示：

0
0 收藏

0 评论
0 收藏
0