如何预测火车系统中孤立节点与其非相邻节点之间给定边距的图网络?
How to predict graph network given edge distance between isolated nodes and their non-adjacent node for a train system?
我正在尝试使用 Python3.0 中的 networkx
库预测给定以下格式的 train.csv 文件的图形网络。 train.csv 文件包含 250123 条人员上下站和时间条目。使用以下信息,我需要预测所有站点之间的图形网络。
我知道我应该使用 BoardingTime
和 AlightingTime
之间的时间差来预测图形网络。
例如第一个条目BoardingStation
是旺角,AlightingStation
是荔景, BoardingTime 和 AlightingTime 之间的时差是 14
分钟。
此时间连同所有其他条目将用于"guess"旺角和之间有多少个车站以及哪些车站赖景。我认为可以包括的一个假设是两个相邻节点之间的距离对于所有节点都是相同的。
然后,我们可以形成一个大图网络预测所有站点的节点链接。对于此示例,火车系统是香港地铁火车系统,因此预测图应该看起来与实际的在线香港地铁地图有些相似。
输出应该看起来像这个 image 但节点名称作为站名称和更大的网络
ID BoardingStation BoardingTime AlightingStation AlightingTime
1 Mongkok 10:01:07 Lai King 10:15:13
2 Tsuen Wan 09:31:45 Mei Foo 09:44:32
3 Disneyland Resort 12:41:37 Prince Edward 13:02:18
4 Tsim Sha Tsui 12:53:30 Mongkok 13:00:09
5 Disneyland Resort 15:11:46 Kowloon Tong 15:39:48
. ... ... ... ...
. ... ... ... ...
. ... ... ... ...
250123 Long Ping 10:52:55 Nam Cheong 11:08:11
我认为您可以采取的最简单的解决方案是为每个站(节点)找到它的所有邻居(与一条边相连)
您可以很容易地找到所有行程的最短行程持续时间,包括该站,如 BoardingStation
或 AlightingStation
一旦你拥有所有的边和节点,使用networkx
或任何其他库
构建图就不是问题了
this solution assumes there are trips in the db between every adjacent pair
and also require only a fraction of the data, although you can use the other data to validate your solution by comparing expected (based on your model) trip's duration to actual
我正在尝试使用 Python3.0 中的 networkx
库预测给定以下格式的 train.csv 文件的图形网络。 train.csv 文件包含 250123 条人员上下站和时间条目。使用以下信息,我需要预测所有站点之间的图形网络。
我知道我应该使用 BoardingTime
和 AlightingTime
之间的时间差来预测图形网络。
例如第一个条目BoardingStation
是旺角,AlightingStation
是荔景, BoardingTime 和 AlightingTime 之间的时差是 14
分钟。
此时间连同所有其他条目将用于"guess"旺角和之间有多少个车站以及哪些车站赖景。我认为可以包括的一个假设是两个相邻节点之间的距离对于所有节点都是相同的。
然后,我们可以形成一个大图网络预测所有站点的节点链接。对于此示例,火车系统是香港地铁火车系统,因此预测图应该看起来与实际的在线香港地铁地图有些相似。
输出应该看起来像这个 image 但节点名称作为站名称和更大的网络
ID BoardingStation BoardingTime AlightingStation AlightingTime
1 Mongkok 10:01:07 Lai King 10:15:13
2 Tsuen Wan 09:31:45 Mei Foo 09:44:32
3 Disneyland Resort 12:41:37 Prince Edward 13:02:18
4 Tsim Sha Tsui 12:53:30 Mongkok 13:00:09
5 Disneyland Resort 15:11:46 Kowloon Tong 15:39:48
. ... ... ... ...
. ... ... ... ...
. ... ... ... ...
250123 Long Ping 10:52:55 Nam Cheong 11:08:11
我认为您可以采取的最简单的解决方案是为每个站(节点)找到它的所有邻居(与一条边相连)
您可以很容易地找到所有行程的最短行程持续时间,包括该站,如 BoardingStation
或 AlightingStation
一旦你拥有所有的边和节点,使用networkx
或任何其他库
this solution assumes there are trips in the db between every adjacent pair
and also require only a fraction of the data, although you can use the other data to validate your solution by comparing expected (based on your model) trip's duration to actual