本文整理汇总了Python中graph_tool.Graph.edge_properties["created_at"][edge]方法的典型用法代码示例。如果您正苦于以下问题:Python Graph.edge_properties["created_at"][edge]方法的具体用法?Python Graph.edge_properties["created_at"][edge]怎么用?Python Graph.edge_properties["created_at"][edge]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graph_tool.Graph
的用法示例。
在下文中一共展示了Graph.edge_properties["created_at"][edge]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: user_network
# 需要导入模块: from graph_tool import Graph [as 别名]
# 或者: from graph_tool.Graph import edge_properties["created_at"][edge] [as 别名]
def user_network(storage, track, session):
g = Graph()
users = defaultdict(g.add_vertex)
g.graph_properties["track"] = g.new_graph_property("string", track)
g.graph_properties["session"] = g.new_graph_property("string", session)
g.edge_properties["created_at"] = g.new_edge_property("int64_t")
for tweet in storage:
tweeter_id = tweet["user__id_str"]
origin_id = tweet["retweeted_status__user__id_str"]
created_at = arrow.get(tweet["created_at"], DATE_FORMAT).timestamp
if origin_id:
edge = g.add_edge(users[tweeter_id], users[origin_id])
g.edge_properties["created_at"][edge] = created_at
return g