SeverinJB / the_lads

Project "Scholarly Network Engine" - Examination for "Computational Thinking and Programming" - Second-cycle degree "Digital Humanities and Digital Knowledge" at the University of Bologna
0 stars 0 forks source link

execution_example.py #9

Open delfimpandiani opened 5 years ago

delfimpandiani commented 5 years ago

# import the class 'ScholarlyNetworkEngine' from the local file 'sne.py'
from sne import ScholarlyNetworkEngine

# create a new object of the class 'ScholarlyNetworkEngine' specifying the input CSV files to process
my_sne = ScholarlyNetworkEngine("metadata_sample.csv", "citations_sample.csv")

# 1. execution example for citation_graph
print(my_sne.citation_graph().edges())

# 2. execution example for coupling
print(my_sne.coupling('10.7717/peerj-cs.111', '10.7717/peerj-cs.38'))

# 3. execution example for aut_coupling
print(my_sne.aut_coupling('Kotaro, Hayashi', 'Satoru, Satake'))

# 4. execution example for aut_distance
print(my_sne.aut_distance('Satoru, Satake'))

# 5. execution example for find_cycles
print(my_sne.find_cycles())

# 6. execution example for cit_count_year
print(my_sne.cit_count_year('Lieven, Billiet', None))
print(my_sne.cit_count_year('Michel, Dumontier', None))
print(my_sne.cit_count_year('Ruben, Verborgh', None))
print(my_sne.cit_count_year('Jürgen, Münch', None))
print(my_sne.cit_count_year('Lieven, Billiet', 2018))
print(my_sne.cit_count_year('Michel, Dumontier', 2017))
print(my_sne.cit_count_year('Ruben, Verborgh', 2017))
print(my_sne.cit_count_year('Jürgen, Münch', 2016))
SeverinJB commented 5 years ago
from sne import ScholarlyNetworkEngine
import time

t1_start = time.perf_counter()
t2_start = time.process_time()

# +++ ScholarlyNetworkEngine Objects +++
my_sne = ScholarlyNetworkEngine("metadata_sample.csv", "citations_sample.csv")

# +++ Methods +++
my_sne.citation_graph()
my_sne.coupling('10.7717/peerj-cs.86','10.7717/peerj-cs.110')
my_sne.aut_distance('Michel, Dumontier')
my_sne.find_cycles()
my_sne.cit_count_year('Michel, Dumontier', None)

t1_stop = time.perf_counter()
t2_stop = time.process_time()

print("--------------------------------------------------")
print("Elapsed time: %.6f [seconds]" % (t1_stop - t1_start))
print("CPU process time: %.6f [milliseconds]" % (t2_stop - t2_start))
print("--------------------------------------------------")