使用Gephi作图动态网络方法
使用Gephi绘制动态网络方法

如果我们使用gephi对这些特征进行建模,我们使用区间的概念来定义一段时间。这有两种基本的方式来对纵向网络进行建模,一种是每个网络集合都有一个特定的时间点(一天,一个月,…),或者是每一个网络片段中的每个元素都有其时间区间。这分别是离散时间表示以及连续时间表示的方式。我们选择第二种方式,因为他更加灵活。
举例来说:

在Gephi中你可以在数据实验室中看到对于点和边的区间是如何被创建的。如果网络是纵向的,将会有一个时间间隔柱。这给出了在图中应该出现的元素的时间间隔。你可以通过在数据实验室配置对话框,开启展示时间间隔图表选项,这样你就可以可视化了。
二、 导入GEXF文件
GEXF格式包括使用第二种方法的所有信息。你定义一个简单的网络然后增加开始和结束的位置归根于设置一个点或边的开始或消失。
1、 基本的例子:
<?xml version="1.0" encoding="UTF-8"?>
<gexfxmlns="http://www.gexf.net/1.1draft"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.gexf.net/1.1draft
http://www.gexf.net/1.1draft/gexf.xsd"
version="1.1">
<graphmode="dynamic"defaultedgetype="directed">
<nodes>
<nodeid="n1"label="Node 1"start="2007"endopen="2009" />
<nodeid="n2"label="Node 2"start="2007"end="2009" />
<nodeid="n3"label="Node 3"start="2008"end="2009" />
</nodes>
<edges>
<edgesource="n1"target="n2" />
<edgesource="n1"target="n3"start="2008"/>
<edgesource="n3"target="n2"start="2008"endopen="2009"/>
</edges>
</graph>
</gexf>
注意以下几点:
我们将mode设为“dynamic”,这是必须的,因为GEXF格式也可以展现静态图。
对于闭区间的就用start和end如果是开区间的就用startopen和endopen。
不强制一定要对于每一个元素都设定一个开始和结束时间。如果不设置自动创建一个[-INFINITY,+infinity]这么个时间间隔,从正无穷到负无穷。如果只有一个边界被定义了,向第二条边似的,那么将会自动变成[2009,+inf].
<gexfxmlns="http://www.gexf.net/1.1draft"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.gexf.net/1.1draft
http://www.gexf.net/1.1draft/gexf.xsd"
version="1.1">
<graphmode="dynamic"defaultedgetype="directed">
<attributesclass="node"mode="dynamic">
<attributeid="price"title="Price"type="float"/>
</attributes>
<nodes>
<nodeid="n1"label="Node 1"start="2007"endopen="2009" >
<attvalues>
<attvaluefor="price"value="25.5"start="2007"end="2008"/>
<attvaluefor="price"value="42.5"start="2008"/>
</attvalues>
</node>
<nodeid="n2"label="Node 2"start="2007"end="2009" >
<attvalues>
<attvaluefor="price"value="12"start="2008"/>
</attvalues>
</node>
<nodeid="n3"label="Node 3"start="2008"end="2009" >
<attvalues>
<attvaluefor="price"value="40.5"start="2008"end="2009" />
</attvalues>
</node>
</nodes>
<edges>
<edgesource="n1"target="n2" />
<edgesource="n1"target="n3"start="2008"/>
<edgesource="n3"target="n2"start="2008"endopen="2009"/>
</edges>
</graph>
</gexf>
attvalues:属性值
注意以下几点:
为了适时展示几个值,方法是重复相同的属性值每一时间段,和相同但有着不同的value和起始和终止的时候。
不强制到处设置一个value,以防错过使用默认值。
对于节点n2,他的价格“12”从2008年开始,但是没有定义结束时间,这会自动调整为[2008,+infinity]。
2016.4.12 本文暂时未写完,未完待续。
一、 Longitudinal纵向网络/动态网络是一种包括时间的信息的简单网络。你可以想象一下关于你的朋友网络;节点数和连接数随着时间的增长而增长,以及属性值也随之变化。如果你有一个
如果我们使用gephi对这些特征进行建模,我们使用区间的概念来定义一段时间。这有两种基本的方式来对纵向网络进行建模,一种是每个网络集合都有一个特定的时间点(一天,一个月,…),或者是每一个网络片段中的每个元素都有其时间区间。这分别是离散时间表示以及连续时间表示的方式。我们选择第二种方式,因为他更加灵活。
举例来说:
在Gephi中你可以在数据实验室中看到对于点和边的区间是如何被创建的。如果网络是纵向的,将会有一个时间间隔柱。这给出了在图中应该出现的元素的时间间隔。你可以通过在数据实验室配置对话框,开启展示时间间隔图表选项,这样你就可以可视化了。
二、 导入GEXF文件
GEXF格式包括使用第二种方法的所有信息。你定义一个简单的网络然后增加开始和结束的位置归根于设置一个点或边的开始或消失。
1、 基本的例子:
<?xml version="1.0" encoding="UTF-8"?>
<gexfxmlns="http://www.gexf.net/1.1draft"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.gexf.net/1.1draft
http://www.gexf.net/1.1draft/gexf.xsd"
version="1.1">
<graphmode="dynamic"defaultedgetype="directed">
<nodes>
<nodeid="n1"label="Node 1"start="2007"endopen="2009" />
<nodeid="n2"label="Node 2"start="2007"end="2009" />
<nodeid="n3"label="Node 3"start="2008"end="2009" />
</nodes>
<edges>
<edgesource="n1"target="n2" />
<edgesource="n1"target="n3"start="2008"/>
<edgesource="n3"target="n2"start="2008"endopen="2009"/>
</edges>
</graph>
</gexf>
注意以下几点:
我们将mode设为“dynamic”,这是必须的,因为GEXF格式也可以展现静态图。
对于闭区间的就用start和end如果是开区间的就用startopen和endopen。
不强制一定要对于每一个元素都设定一个开始和结束时间。如果不设置自动创建一个[-INFINITY,+infinity]这么个时间间隔,从正无穷到负无穷。如果只有一个边界被定义了,向第二条边似的,那么将会自动变成[2009,+inf].
<gexfxmlns="http://www.gexf.net/1.1draft"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.gexf.net/1.1draft
http://www.gexf.net/1.1draft/gexf.xsd"
version="1.1">
<graphmode="dynamic"defaultedgetype="directed">
<attributesclass="node"mode="dynamic">
<attributeid="price"title="Price"type="float"/>
</attributes>
<nodes>
<nodeid="n1"label="Node 1"start="2007"endopen="2009" >
<attvalues>
<attvaluefor="price"value="25.5"start="2007"end="2008"/>
<attvaluefor="price"value="42.5"start="2008"/>
</attvalues>
</node>
<nodeid="n2"label="Node 2"start="2007"end="2009" >
<attvalues>
<attvaluefor="price"value="12"start="2008"/>
</attvalues>
</node>
<nodeid="n3"label="Node 3"start="2008"end="2009" >
<attvalues>
<attvaluefor="price"value="40.5"start="2008"end="2009" />
</attvalues>
</node>
</nodes>
<edges>
<edgesource="n1"target="n2" />
<edgesource="n1"target="n3"start="2008"/>
<edgesource="n3"target="n2"start="2008"endopen="2009"/>
</edges>
</graph>
</gexf>
attvalues:属性值
注意以下几点:
为了适时展示几个值,方法是重复相同的属性值每一时间段,和相同但有着不同的value和起始和终止的时候。
不强制到处设置一个value,以防错过使用默认值。
对于节点n2,他的价格“12”从2008年开始,但是没有定义结束时间,这会自动调整为[2008,+infinity]。
3. 动态权值
这个规则定义了边户型通过权值关键字当标识符。然后,使用多次“attvalue”就像上面设置给不同的时间点设置不同的价值似的。
转变现有的时间间隔柱
想象你和一些朋友的社交网络。每个节点都是一个朋友,一个属性列是你遇到一个朋友的日期。问题是我们怎样才能将这个列转换成一个动态的时间间隔,然后通过时间线探索整个网络。
步骤1:点击数据实验室-合并列

步骤2:在右窗格中移动你想要创建时间间隔的列。如果你既有开始时间和结束时间,那么就指定两列。在我们的列子中,'First Met'只是一个开始列。然后选择时间间隔在那个选择器当中。

注意,开区间似乎已经被弃用了。
步骤3:选择哪列是开始,选择哪列是结束。如果没有尽头,就留空。如果列是数字化的(整数,浮点型,长浮点型),那么就选择“parse numbers”。如果数据是string形式的,他们也可以被解析转换为时间间隔。我们的“fiist met”列就是一年中的某一天,就是一个数字而已。

使用时间框架,导入几个静态文件
Note that this method implementation is still experimental and may not work in all cases. Be sure to verify the following points:
Your node identifiers are exactly the same between the files. If not, at least the labels are (you can choose in the wizard).
If GEXF, your network mode is set at static
There is no previous graph in the workspace when you start importing Time Frame
Attribute columns are the same in all files
We can take for instance three GEXF files and say each of this file is for a particular year, the network in 2007, in 2008 and in 2009.
The static network in 2007, notice the price attribute:
<?xml version="1.0" encoding="UTF-8"?>
<gexfxmlns="http://www.gexf.net/1.1draft"version="1.1">
<graphmode="static"defaultedgetype="directed">
<attributesclass="node"type="static">
<attributeid="price"title="Price"type="int"/>
</attributes>
<nodes>
<nodeid="1"label="Node 1">
<attvaluefor="price"value="12"/>
</node>
<nodeid="2"label="Node 2">
<attvaluefor="price"value="8"/>
</node>
<nodeid="3"label="Node 3">
<attvaluefor="price"value="5"/>
</node>
</nodes>
<edges>
<edgesource="1"target="2"weight="1" />
<edgesource="1"target="3"weight="2" />
</edges>
</graph>
</gexf>
The static network in 2008, the node '3' disappeared and a node '4' appears. Prices and edge's weight have changed also.
<?xml version="1.0" encoding="UTF-8"?>
<gexfxmlns="http://www.gexf.net/1.1draft"version="1.1">
<graphmode="static"defaultedgetype="directed">
<attributesclass="node"type="static">
<attributeid="price"title="Price"type="int"/>
</attributes>
<nodes>
<nodeid="1"label="Node 1">
<attvaluefor="price"value="15"/>
</node>
<nodeid="2"label="Node 2">
<attvaluefor="price"value="6"/>
</node>
<nodeid="4"label="Node 4">
<attvaluefor="price"value="8"/>
</node>
</nodes>
<edges>
<edgesource="1"target="2"weight="4" />
<edgesource="1"target="4"weight="3" />
<edgesource="2"target="4"weight="1" />
</edges>
</graph>
</gexf>
The static network in 2009, the node '3' is back, the node '2' is gone and priced changed again.
<?xml version="1.0" encoding="UTF-8"?>
<gexfxmlns="http://www.gexf.net/1.1draft"version="1.1">
<graphmode="static"defaultedgetype="directed">
<attributesclass="node"type="static">
<attributeid="price"title="Price"type="int"/>
</attributes>
<nodes>
<nodeid="1"label="Node 1">
<attvaluefor="price"value="10"/>
</node>
<nodeid="3"label="Node 3">
<attvaluefor="price"value="3"/>
</node>
<nodeid="4"label="Node 4">
<attvaluefor="price"value="12"/>
</node>
</nodes>
<edges>
<edgesource="1"target="3"weight="5" />
</edges>
</graph>
</gexf>
导入Gephi
步骤1:
这个规则定义了边户型通过权值关键字当标识符。然后,使用多次“attvalue”就像上面设置给不同的时间点设置不同的价值似的。
转变现有的时间间隔柱
想象你和一些朋友的社交网络。每个节点都是一个朋友,一个属性列是你遇到一个朋友的日期。问题是我们怎样才能将这个列转换成一个动态的时间间隔,然后通过时间线探索整个网络。
步骤1:点击数据实验室-合并列
步骤2:在右窗格中移动你想要创建时间间隔的列。如果你既有开始时间和结束时间,那么就指定两列。在我们的列子中,'First Met'只是一个开始列。然后选择时间间隔在那个选择器当中。
注意,开区间似乎已经被弃用了。
步骤3:选择哪列是开始,选择哪列是结束。如果没有尽头,就留空。如果列是数字化的(整数,浮点型,长浮点型),那么就选择“parse numbers”。如果数据是string形式的,他们也可以被解析转换为时间间隔。我们的“fiist met”列就是一年中的某一天,就是一个数字而已。
使用时间框架,导入几个静态文件
Note that this method implementation is still experimental and may not work in all cases. Be sure to verify the following points:
Your node identifiers are exactly the same between the files. If not, at least the labels are (you can choose in the wizard).
If GEXF, your network mode is set at static
There is no previous graph in the workspace when you start importing Time Frame
Attribute columns are the same in all files
We can take for instance three GEXF files and say each of this file is for a particular year, the network in 2007, in 2008 and in 2009.
The static network in 2007, notice the price attribute:
<?xml version="1.0" encoding="UTF-8"?>
<gexfxmlns="http://www.gexf.net/1.1draft"version="1.1">
<graphmode="static"defaultedgetype="directed">
<attributesclass="node"type="static">
<attributeid="price"title="Price"type="int"/>
</attributes>
<nodes>
<nodeid="1"label="Node 1">
<attvaluefor="price"value="12"/>
</node>
<nodeid="2"label="Node 2">
<attvaluefor="price"value="8"/>
</node>
<nodeid="3"label="Node 3">
<attvaluefor="price"value="5"/>
</node>
</nodes>
<edges>
<edgesource="1"target="2"weight="1" />
<edgesource="1"target="3"weight="2" />
</edges>
</graph>
</gexf>
The static network in 2008, the node '3' disappeared and a node '4' appears. Prices and edge's weight have changed also.
<?xml version="1.0" encoding="UTF-8"?>
<gexfxmlns="http://www.gexf.net/1.1draft"version="1.1">
<graphmode="static"defaultedgetype="directed">
<attributesclass="node"type="static">
<attributeid="price"title="Price"type="int"/>
</attributes>
<nodes>
<nodeid="1"label="Node 1">
<attvaluefor="price"value="15"/>
</node>
<nodeid="2"label="Node 2">
<attvaluefor="price"value="6"/>
</node>
<nodeid="4"label="Node 4">
<attvaluefor="price"value="8"/>
</node>
</nodes>
<edges>
<edgesource="1"target="2"weight="4" />
<edgesource="1"target="4"weight="3" />
<edgesource="2"target="4"weight="1" />
</edges>
</graph>
</gexf>
The static network in 2009, the node '3' is back, the node '2' is gone and priced changed again.
<?xml version="1.0" encoding="UTF-8"?>
<gexfxmlns="http://www.gexf.net/1.1draft"version="1.1">
<graphmode="static"defaultedgetype="directed">
<attributesclass="node"type="static">
<attributeid="price"title="Price"type="int"/>
</attributes>
<nodes>
<nodeid="1"label="Node 1">
<attvaluefor="price"value="10"/>
</node>
<nodeid="3"label="Node 3">
<attvaluefor="price"value="3"/>
</node>
<nodeid="4"label="Node 4">
<attvaluefor="price"value="12"/>
</node>
</nodes>
<edges>
<edgesource="1"target="3"weight="5" />
</edges>
</graph>
</gexf>
导入Gephi
步骤1: