2

I'm working with arabic_reshaper to display my data from the CSV file (i saved the file using the save as type: CSV UTF-8(Comma delimited))

To                   From
أَبُو كَامِلٍ الْجَحْدَرِيُّ          عَبْدُ الْوَاحِدِ
عَبْدُ الْوَاحِدِ               الْأَعْمَشُ

I would like display the graph using networkx as follow:

arabic graph

My codes are as follow

import arabic_reshaper

data = pd.read_csv('textArab6.csv')
df2 = pd.DataFrame(data)

G = nx.from_pandas_edgelist(df2,arabic_reshaper.reshape('From'),arabic_reshaper.reshape('To'))
nx.draw(G,
        with_labels=True,
        node_color="skyblue",
        node_size=5000,
       )

Definitey before i post my question here, i already referred from this url: Right-to-left Support in Python Networkx and matplotlib However the codes sample showed that the letter was not extracted from a csv file. My problem is that, how to display the arabic letters properly in graph in which the data taken from a csv file.

Jas
  • 21
  • 5
  • Have you tried directly doing `G = nx.from_pandas_edgelist(df,'From','To')`? Seems to display without problems for me – yatu Apr 26 '20 at 15:56
  • @yatu, yeah i did. It stil did not work. Each arabic characters did not connected each other – Jas Apr 26 '20 at 16:02
  • So each arabic string is not a node? Please can you make that clearer? – yatu Apr 26 '20 at 16:03
  • The graph shows that each Arabic string is a node, They're written from left to right and not attached. – faressalem Apr 26 '20 at 16:05
  • Yes, tha's true. I attached the image in the above link >> arabic graph – Jas Apr 26 '20 at 16:09

0 Answers0