1
0
Fork 0
Old engine for Continuous Time Bayesian Networks. Superseded by reCTBN. 🐍 https://github.com/madlabunimib/PyCTBN
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
PyCTBN/main_package/classes/network_graph.py

43 lines
920 B

import numpy as np
import sample_path as sp
import networkx as nx
import os
class NetworkGraph():
"""
Rappresenta un grafo dinamico con la seguente struttura:
:sample_path: le traiettorie/a da cui costruire il grafo
:graph: la struttura dinamica che definisce il grafo
"""
def __init__(self, sample_path):
self.sample_path = sample_path
self.graph = nx.DiGraph()
def init_graph(self):
self.sample_path.build_trajectories()
self.sample_path.build_structure()
print(self.sample_path.structure.list_of_edges())
self.add_edges(self.sample_path.structure.list_of_edges())
def add_edges(self, list_of_edges):
self.graph.add_edges_from(list_of_edges)
######Veloci Tests#######
os.getcwd()
os.chdir('..')
path = os.getcwd() + '/data'
s1 = sp.SamplePath(path)
g1 = NetworkGraph(s1)
g1.init_graph()
print(g1.graph)