Initialized graph classes
This commit is contained in:
parent
378e2eba97
commit
03d02a7c3f
18
network_attack_propagation.py
Normal file
18
network_attack_propagation.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
class Node:
|
||||||
|
def __init__(self):
|
||||||
|
self.is_infected = False
|
||||||
|
|
||||||
|
|
||||||
|
class Edge:
|
||||||
|
def __init__(self, node_a: Node, node_b: Node, weight: float):
|
||||||
|
self.node_a = node_a
|
||||||
|
self.node_b = node_b
|
||||||
|
self.weight = weight
|
||||||
|
|
||||||
|
|
||||||
|
class Graph:
|
||||||
|
def __init__(self):
|
||||||
|
self.edges = []
|
||||||
|
|
||||||
|
def add_edge(self, edge: Edge):
|
||||||
|
self.edges.append(edge)
|
Loading…
Reference in New Issue
Block a user