Skip to content

Commit

Permalink
added node image suuport
Browse files Browse the repository at this point in the history
  • Loading branch information
imohitmayank committed Sep 3, 2022
1 parent 5692d16 commit d09ad0b
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 83 deletions.
2 changes: 1 addition & 1 deletion jaal/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# import Jaal at root
from .jaal import Jaal
# version in setup fetched from here
__version__ = "0.1.2"
__version__ = "0.1.3"
160 changes: 80 additions & 80 deletions jaal/datasets/got/got_node_df.csv
Original file line number Diff line number Diff line change
@@ -1,80 +1,80 @@
id,gender,screentime
Illyrio-Mopatis,male,3.3
Jory-Cassel,male,6.15
Viserys-Targaryen,male,20.3
Mirri-Maz-Duur,female,7.3
Jhogo,male,1
Halder,male,1
Jeor-Mormont,male,21
Robert-Baratheon,male,30.3
Jaremy-Rykker,male,1
Robb-Stark,male,77.45
Theon-Greyjoy,male,123.3
Pypar,male,12
Pycelle,male,1
Hallis-Mollen,male,1
Vayon-Poole,male,1
Bronn,male,64
Eddard-Stark,male,99.45
Qotho,male,5.15
Drogo,male,25
Arya-Stark,female,189.15
Bran-Stark,male,86
Jon-Snow,male,268.15
Syrio-Forel,male,7.15
Loras-Tyrell,male,33
Gared,male,2.3
Haggo,male,1
Aggo,male,1
Rodrik-Cassel,male,12.45
Jhiqui,female,1
Brynden-Tully,male,1
Gregor-Clegane,male,17.15
Benjen-Stark,male,12
Alyn,female,1
Aerys-II-Targaryen,male,1
Vardis-Egen,male,3
Walder-Frey,male,15.45
Osha,female,29.45
Ogo,male,1
Stannis-Baratheon,male,73.15
Jaime-Lannister,male,162.3
Mord,male,2.45
Cersei-Lannister,female,201.45
Todder,male,1
Jon-Arryn,male,1
Jeyne-Poole,female,1
Sandor-Clegane,male,1
Rickon-Stark,male,12.45
Kevan-Lannister,male,8.3
Barristan-Selmy,male,37.15
Shae,female,47.15
Petyr-Baelish,male,1
Hodor,male,29
Tyrion-Lannister,male,293.3
Will-(prologue),male,1
Tomard,male,1
Mycah,male,1
Alliser-Thorne,male,26
Samwell-Tarly,male,121.45
Joffrey-Baratheon,male,70.15
Aemon-Targaryen-(Maester-Aemon),male,1
Tywin-Lannister,male,78.15
Daenerys-Targaryen,female,221.3
Catelyn-Stark,female,82.45
Irri,female,10
Renly-Baratheon,male,24
Lysa-Arryn,female,16.3
Mordane,female,1
Waymar-Royce,male,2.45
Lyanna-Stark,female,1
Doreah,female,12.3
Rhaegar-Targaryen,male,1
Grenn,male,21.15
Jorah-Mormont,male,117.3
Sansa-Stark,female,199.3
Luwin,male,1
Varys,male,1
Myrcella-Baratheon,female,11.45
Shagga,male,5
Brandon-Stark,male,1
id,gender,screentime,node_image_url
Illyrio-Mopatis,male,3.3,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Jory-Cassel,male,6.15,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Viserys-Targaryen,male,20.3,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Mirri-Maz-Duur,female,7.3,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Jhogo,male,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Halder,male,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Jeor-Mormont,male,21,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Robert-Baratheon,male,30.3,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Jaremy-Rykker,male,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Robb-Stark,male,77.45,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Theon-Greyjoy,male,123.3,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Pypar,male,12,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Pycelle,male,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Hallis-Mollen,male,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Vayon-Poole,male,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Bronn,male,64,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Eddard-Stark,male,99.45,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Qotho,male,5.15,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Drogo,male,25,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Arya-Stark,female,189.15,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Bran-Stark,male,86,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Jon-Snow,male,268.15,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Syrio-Forel,male,7.15,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Loras-Tyrell,male,33,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Gared,male,2.3,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Haggo,male,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Aggo,male,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Rodrik-Cassel,male,12.45,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Jhiqui,female,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Brynden-Tully,male,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Gregor-Clegane,male,17.15,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Benjen-Stark,male,12,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Alyn,female,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Aerys-II-Targaryen,male,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Vardis-Egen,male,3,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Walder-Frey,male,15.45,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Osha,female,29.45,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Ogo,male,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Stannis-Baratheon,male,73.15,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Jaime-Lannister,male,162.3,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Mord,male,2.45,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Cersei-Lannister,female,201.45,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Todder,male,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Jon-Arryn,male,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Jeyne-Poole,female,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Sandor-Clegane,male,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Rickon-Stark,male,12.45,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Kevan-Lannister,male,8.3,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Barristan-Selmy,male,37.15,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Shae,female,47.15,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Petyr-Baelish,male,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Hodor,male,29,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Tyrion-Lannister,male,293.3,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Will-(prologue),male,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Tomard,male,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Mycah,male,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Alliser-Thorne,male,26,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Samwell-Tarly,male,121.45,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Joffrey-Baratheon,male,70.15,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Aemon-Targaryen-(Maester-Aemon),male,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Tywin-Lannister,male,78.15,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Daenerys-Targaryen,female,221.3,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Catelyn-Stark,female,82.45,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Irri,female,10,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Renly-Baratheon,male,24,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Lysa-Arryn,female,16.3,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Mordane,female,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Waymar-Royce,male,2.45,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Lyanna-Stark,female,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Doreah,female,12.3,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Rhaegar-Targaryen,male,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Grenn,male,21.15,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Jorah-Mormont,male,117.3,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Sansa-Stark,female,199.3,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Luwin,male,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Varys,male,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Myrcella-Baratheon,female,11.45,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Shagga,male,5,https://i.postimg.cc/05HtCgHF/got-logo.jpg
Brandon-Stark,male,1,https://i.postimg.cc/05HtCgHF/got-logo.jpg
11 changes: 9 additions & 2 deletions jaal/datasets/parse_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,17 @@ def parse_dataframe(edge_df, node_df=None):
else:
# convert the node id column to string
node_df.loc[:, 'id'] = node_df.loc[:, 'id'].astype(str)
# see if node imge url is present or not
node_image_url_flag = 'node_image_url' in node_df.columns
# create the node data
for node in node_df.to_dict(orient='records'):
nodes.append({**node, **{'label': node['id'], 'shape': 'dot', 'size': 7}})

if not node_image_url_flag:
nodes.append({**node, **{'label': node['id'], 'shape': 'dot', 'size': 7}})
else:
nodes.append({**node, **{'label': node['id'], 'shape': 'circularImage',
'image': node['node_image_url'],
'size': 20}})

# create edges from df
edges = []
for row in edge_df.to_dict(orient='records'):
Expand Down

0 comments on commit d09ad0b

Please sign in to comment.