本文整理匯總了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