networking中的节点关系?

我有两列A和B,分别包含不同组织和不同基金的ID。 A列有1,200个不同的值(不同的组织)和重复。 B列有大约350个不同的值(不同的基金)与重复。 大约有8,500个单独的行,每个行都是不同的,因为它们代表基金向组织提供的赠款。

问题是,多个基金向同一个组织提供资助,以便这些资金基本上通过拨款相互“连接”。

我想find1)一个基金通过拨款与其他基金相关的数量,2)这些基金之间的关系最密切。

这有道理吗? 如果是这样,你怎么去解决这些价值? 我提取了SQL Server中的数据,并尝试使用R sna包,NodeXL和一些嵌套的Excel函数无济于事。 我超出了我的元素。

如果我理解你的问题,这是你需要的。

select b.fund, COUNT(*) from yourtable a inner join yourtable b on a.org = b.org group by b.fund order by COUNT(*) desc 

(注:如果(org1,fund1)和(org2,fund1)和(org1,fund2)存在,它会返回(fund1,3 )(基金2,3),因为与基金1和基金2相关联的组织有三种基金关系。

如果您只想计算这种关系中涉及的DISTINCT资金,请使用:

 select b.fund, COUNT(distinct a.fund) from yourtable a inner join yourtable b on a.org = b.org group by b.fund order by COUNT(distinct a.fund) desc 

请注意,这将自行计数。

这两者都会自动排列最高数量的相关基金。

编辑:在了解更多关于这个问题和表结构,我认为这工作:

  select f1.fund_ID, f2.fund_ID, Count(distinct o1.org_ID) from Fund f1 inner join orgs o1 on o1.grnt_id = f1.grnt_id inner join orgs o2 on o1.org_ID = o2.org_id and o1.grnt_id <> o2.grnt_id inner join fund f2 on f2.grnt_id = o2.grnt_id and f2.fund_id <> f1.fund_Id where f1.FUND_ID < f2.FUND_ID group by f1.fund_ID, f2.fund_ID order by count(o1.org_ID) desc 

在这里输入图像说明