代码拉取完成,页面将自动刷新
*! Date : 3sept2014
*! Version : 1.0.4
*! Author : Thomas Grund, Linkoping University
*! Email : contact@nwcommands.org
capture program drop nwpermute
program nwpermute
version 9.0
syntax [anything(name=netname)], [ id(string) xvars name(string) vars(string) stub(string) noreplace ]
_nwsyntax `netname', max(1)
scalar onevars = "\$nw_`id'"
local vars `=onevars'
// generate valid network name and valid varlist
if "`name'" == "" {
local name "`netname'_perm"
}
if "`stub'" == "" {
local stub "perm"
}
nwvalidate `name'
local name = r(validname)
local varscount : word count `vars'
if (`varscount' != `nodes'){
nwvalidvars `nodes', stub(`stub')
local permvars "$validvars"
}
else {
local permvars "`vars'"
}
nwtomata `netname', mat(onenet)
mata: perm = permutenet(onenet)
if "`directed'"=="false" {
local undirected = "undirected"
}
nwduplicate `netname', name(`name')
nwreplacemat `name', newmat(perm)
end
capture mata mata drop permutenet()
mata:
real matrix permutenet(real matrix nwadj) {
nsize = rows(nwadj)
permutationVec = unorder(nsize)
return (nwadj[permutationVec, permutationVec])
}
end
*! v1.5.0 __ 17 Sep 2015 __ 13:09:53
*! v1.5.1 __ 17 Sep 2015 __ 14:54:23
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。