どのように私はNetworkxまたはDyNetx上のグラフのリストから動的なグラフを生成することができます

ユーセフSnoussi:

まあ私が持っていることは、私は、私はグラフのリストに入れて管理していること、エッジファイルの束ですが、問題は、私は単一の動的ネットワークとして、それらを処理したいですが、私はそれを行う方法上の任意の手掛かりを持っていません「すべての応答がないとnetworkxとdynetxのドキュメントを中心に見てきまし。だからここに私はこれまで何をやったかです:

import networkx as nx
import matplotlib.pyplot as plt
from operator import itemgetter
import dynetx as dnx
#from glob import glob
import os

#path to the files
path = '../Ants'
#Create a list of graph from the files
G = [nx.read_weighted_edgelist(path+'/'+f, create_using=nx.Graph(), nodetype=int) for f in os.listdir(path) ]

Sparky05:

DyNetxパッケージには、彼らの中にいくつかの方法を述べてDynGraphドキュメントを。以下はあなたの問題を解決する必要があります。

import networkx as nx
import matplotlib.pyplot as plt
from operator import itemgetter
import dynetx as dnx
#from glob import glob
import os

#path to the files
path = '../Ants'
#Create a list of graph from the files
list_of_snapshots = [nx.read_weighted_edgelist(path+'/'+f, create_using=nx.Graph(), nodetype=int) for f in os.listdir(path) ]

dynamic_graph = dnx.DynGraph()
for t, graph in enumerate(list_of_snapshots):
    dynamic_graph.add_interactions_from(graph.edges(data=True), t=t)

おすすめ

転載: http://43.154.161.224:23101/article/api/json?id=365813&siteId=1