测量空间网络中浓度分布的算法。

GPRas的Python项目详细描述


#地理pagerank算法

一组用于测量空间网络中浓度分布的算法。



==============

/>
文章:
Chin,W.C.B.,&Wen,T.H.(2015)。地理修正的pagerank算法:识别地理空间网络中人类运动的空间集中度。公共科学图书馆一期10(10):e0139509。doi:10.1371/journal.pone.0139509.


文章作者:
**wei chien benny chin**,tzai hung wen


开放访问链接:
<;a href="http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0139509"target="blank">;文章(plosone)<;/a>;


=======

相应地从经纬度计算:

-pr
-wpr
-ddpr(在上面的plosone文章中提出)
-gpr(在上面的plosone文章中提出)
-eddpr(在上面的plosone文章中提出)
-egpr(在上面的plosone文章中提出)

==============一个值得关注的是,一个值得关注的是,在这一点上,这种情况下,这种依赖性





-numpy
-大熊猫
-peopandas
-geopandas
-shapely
-networkx



=================================

================================================
首先安装shapely。如果您使用的是Anaconda(Miniconda),则可以使用Conda。

`````
Conda安装-c scitols shapely=1.5.13
`````


Geopandas需要在安装之前安装,这可能很难安装。
首先从这里下载:http://www.lfd.uci.edu/~gohlke/pythonlibs/


-gdal
-pyproj
-fiona


p-install

``sh
pip-install-xxx gdal--.whl
pip-install-xxx pyproj--.whl
pip-install-xxx-pyproj--.whl
pip-install-xxx-fiona--.whl

` ` `
` `>
` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `

=======目前,国际上的一些情况还未得到足够的重视,在这种情况下,导入模块


``python
``python
``python

准备FILe路径和文件设置信息


``python
node file='test'u data/tp'u nodes.csv'
linkfile='test'u data/tp'u links.csv'
node'u file setup={'node'id''id''nid','xcoror''xcoror','ycor''ycor''ycor'''ycor''''ycor'}



``python
``python

nodefile='test data/tp linkfile='test'data/tp.csv.csv'

node'U级aph object


`` python
sg=gpr.gpr as()
`````


>从csv文件中设置数据集
`` python
sg.dataset.dataset.dataset.dataset从csv(nodefile、linkfile、node文件设置、link文件设置、link文件设置)中设置数据集
``````````


>

**对于nx.graph object**
```>`````````````>


>>
=````````````;朱在创建nx之前读取文件的st。graph
ndf=pd.read.read.csv(node file)
nii=ndf[node\u filesetup['node\u id']].tolist()
nxx=ndf[node\u filesetup['xcor']].tolist()
nyy=ndf[node\u filesetup['ycor']].tolist()
nodes=[(ii,dict(xxx=xx,yyy=yy=xx,yy=yy=yy=yy=yy=yy=yy=yy=yy=yx,yy=yy=yy=yy=yy=yx=y一,nxx
edf=pd.read_csv(linkfile)
eoo=edf[link_filesetup['ori']].tolist()
edd=edf[link_filesetup['des'].tolist()
edd=edd=edd=edd=edd=edf[link_filesetup['des'].tolist()
eds=[(oo,dd)oo,dd in-zip(eoo,edd)



g=nx.graph()
g>g=nx.graph()>g.g/>br/>g.add u nodes u从(nodes)节点_lis)

信息
node_setup=dict(xcor'x x x,ycor'y y y''ycor'yyy''ycor'yy'''xx,y列来自nodes attr的x,y列来自nodesattr。
link setup=none

sg.dataset.from_nx(ag,node_setup,link_setup)
````
```

`` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `>SG.初始化(IT操作=5000,α=1,β=1,γ=1。)
````

使用上述参数计算所有这些参数(6 prs)
`` python
sg.calculateAll()
````

>使用更新的参数计算每个参数
`` python
`` sg.pr()
sg.wpr(alpha=2,update=true)
sg.ddpr(beta=2,update=true)
sg.gpr(alpha=3,beta=2,update=true)
sg.eddpr(gamma=0.6,update=true)
sg.egpr(alpha=3,gamma=0.2,update=true)
````
这些计算将更改摘要输出的参数,但不会更改从初始化开始设置的默认参数(对于没有参数设置的计算,例如alpha=none)。

e结果采用pandas数据帧格式
get summary df

``python
summary df=sg.get_summary()
print summary_df.head()
````


``python
result_df=sg.get_results();默认为所有6个
print result_df.head()

打印部件_result_df.head()
````

导出结果
结果可以直接导出为csv格式和shapfile格式

**摘要表**

``python
sgsult/temp_summary.csv')
`````



**到csv文件**
````python
sg.to_csv(filename='result/temp_outpudd_dd_g.csv,items=['ddpr','gpr']'filename='result/temp_outpudd_dd_g.csv,items=['ddpr','gpr']


;同样,同样,如果csv()items=none

sg sg.all_csv(filename='result/temp/temp/temp**
准备CRS字符串,或者默认为none
``python
crs67='+proj=tmerc+lat=0+lon=121+k=0.99999+x=250000+y=0+ellps=0+ellps=aust+towgs84=-752,--358,--179,-0.00000116998,0.0000018398,0.0000009822,0.000023229+units=m+no+nou-defs'
`````
```导出文件,其中包括一个导出文件,其中包括一个导出文件,包括一个导出文件,其中包括一个导出一个包含一个。点shpfile表示节点和浓度结果,shp file表示边缘(内部没有结果,仅用于映射)


sg.将两个结果(pr和wpr)输出到一个文件中所有的6个prs


`` python
sg.all_-to _-shps(filename_prefix'result/temp_-shp,crs=crs67)
`` ` `

` ` 35
`` python
` `` python
` ` `` python
` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` pos=sg.to_nx(items=["ddpr"])
````

绘制networkx对象的演示
`` python
将matplotlib.pyplot导入为plt

ss=[]
对于n,d in ag.nodes项目(data=true):
ss.append(d['ddpr\u score']*5000.)

fig,ax=plt.subplots()
nx.draw\u networkx节点(ag,pos=pos,node\u size=ss)
nx.draw\u networkx_边缘(ag,pos=pos,alpha=0.3)
ax.set_-aspect('equal')
plt.show()
`` `


=======================================


;文件结构


``sh ``sh ``sh ` sh `=>>地理pagerrank算法

/>;建建建建建建建建建建
/><
/>////////` ` ` `-x86_64
—GPRAS
{{{}{{}{{}{}{}{{}{{}{{}{{{{}}{{}{{{{{{}{{{{{}{{}{{}{{}{}{{}{{{}{{}{{}{{}{{{}{{}{{}{}{{}{}{}{}{}}生物—数据导入—数据导入—NX.py
年年年年鉴年年年鉴年年年鉴年年鉴年鉴年鉴—文件读取—文件读取—CSV.py
年鉴年鉴年年鉴年鉴年鉴—数据读取—数据写入—数据写入—数据写入—数据写入年鉴年鉴年鉴年鉴年鉴年鉴年鉴年鉴年鉴年鉴年鉴年鉴年鉴年鉴s
对企业而言,它是一种重要的物质财富
/>{{{}{{{{{}{}{{}{{}{{{{{}{{}{{}{{{}}{{}{{{{{{{}{{}{{{}{{{{{}{{}{{{{}{{{{{{}{{}{}{{{}{{}}{}{{——距离
-Py2.7.鸡蛋
/>—gpras-0.1.0.焦油.gz
whl
.7.鸡蛋
.7.鸡蛋
/>
一、演示结果
相关测试数据
相关测试数据
相关测试数据
相关测试数据
相关测试数据
相关测试数据{{{{{{{{{{{{{}{{}{{{{{}{{}{{}{{}{}{{{{}{{}{{}{{{}{{{}{{}{{}{}{{{}{{}{}}{}{节点.csv
年报年年年年报年年年报年年报年年报年年报年年报年年报年报年报年报年报年报年报年报年报年报年报年报年报年报年报年报年报年年报年年报年报年年报年报年报年报年报年报年报年报160;——输入函数py
│   │   │   ├── DataImport_nx.py
│   │   │   ├── FileReading_csv.py
│   │   │   └── __init__.py
│   │   ├── output_func.py
│   │   └── output_funcs
│   │   ├── __init__.py
│160;—依赖关系_links.txt
—pkg-info
——需要.txt
——sources.txt
——顶级.txt
——license.txt
——manifest.in
——readme.md
——setup.py

```

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java使图像以正确的速度在屏幕上移动,以适应所有显示   内存Java分配:从预先存在/分配的池中分配对象   java这种书写方式?   Java正则表达式查找字符串的开头   java是否可以创建一个类来处理安卓中的所有日志代码(例如log.d(TAG,message))   如何使用Selenium和java单击WebTable任意页面上的WebElement   java解析字符串中的文件名   java刷新JTree内容   java如何覆盖RequestMappingHandler   爪哇数石头、布、剪刀赢了多少   struts中的java无效令牌   swing JTree,优化算法,Java   java Tomcat和SSL:密钥库格式无效