-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmetaknowledge.py
More file actions
81 lines (48 loc) · 1.74 KB
/
metaknowledge.py
File metadata and controls
81 lines (48 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# -*- coding: utf-8 -*-
"""MetaKnowledge.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1ccyWz_DxzR4sKHxGpgak96XKyggQD_dw
"""
!pip3 install metaknowledge
import metaknowledge as mk
import networkx as nx
# Commented out IPython magic to ensure Python compatibility.
import matplotlib.pyplot as plt
# %matplotlib
RC = mk.RecordCollection("/content/savedrecs_mk.txt")
print("RC is a " + str(RC))
"""# Making a co-citation network"""
CoCitation = RC.networkCoCitation()
print(mk.graphStats(CoCitation, makeString = True))
coCiteJournals = RC.networkCoCitation(nodeType = 'journal', dropNonJournals = True)
print(mk.graphStats(coCiteJournals))
nx.draw_spring(coCiteJournals)
"""# Making a citation network"""
citationsA = RC.networkCitation(nodeType = 'year', keyWords = ['A'])
print(mk.graphStats(citationsA))
nx.draw_spring(citationsA, with_labels = True)
"""# Making a co-author network
"""
coAuths = RC.networkCoAuthor()
print(mk.graphStats(coAuths))
"""# Exporting graphs"""
mk.writeGraph(coAuths, "/content/coAuths")
RCfiltered = mk.RecordCollection()
import pandas
recDataFrame = pandas.DataFrame(RC.makeDict())
recDataFrame
import networkx as nx
# Commented out IPython magic to ensure Python compatibility.
import matplotlib.pyplot as plt
# %matplotlib inline
import metaknowledge.contour.plotting as mkv
RC = mk.RecordCollection("/content/wos_scientometrics.txt")
CoCitation = RC.networkCoCitation()
print(mk.graphStats(CoCitation, makeString=True))
CoCitation.nodes(data = True)[0]
CoCitation.edges(data = True)[0]
coCiteJournals = RC.networkCoCitation(nodeType = 'journal', dropNonJournals = True)
print(mk.graphStats(coCiteJournals))
"""# Making a citation network
"""