File size: 427 Bytes
95a3fe5
 
3fc7538
 
 
 
95a3fe5
 
3fc7538
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
"""GraphAnalyzer uses some open source graph library for network analysis
"""
import networkx as nx


class GraphAnalyzer:
    def __init__(self, is_directed: bool = False):
        self.graph = nx.DiGraph() if is_directed else nx.Graph()

    def add_node(self, node, **kwargs):
        self.graph.add_node(node, **kwargs)

    def add_edge(self, first_node, second_node):
        self.graph.add_edge(first_node, second_node)