1 '''Takes a CSV of retrieved articles, and creates an igraph
2 network from them (not even close to done)'''
4 class CitationNetwork(igraph.Graph):
5 def __init__(self, network_type):
6 super().__init__(directed=True)
8 self.temp_vertices = []
9 self.network_type = network_type
11 def add_vertices(self, to_node, from_nodes):
12 self.temp_vertices += [[from_node, to_node] for from_node in from_nodes]
14 def make_network(self):
15 # Get the unique set of nodes, and add them.
16 nodes = set([v for v in self.temp_vertices if v['eid'] not in self.vs['name']])
18 self.add_vertices(nodes)
19 self.add_edges(self.temp_edges)
22 def collapse_weights(self):
23 self.simplify(combine_edges={"weight": "sum"})
25 def add_citations(eid, citations):
26 self.retrieved_eids.append(eid)