csrgraph can not deal with direction graph?
wangbingnan136 opened this issue · 7 comments
Hi,
CSRGraph is supposed to deal with directed graphs just fine by default.
Could you give me a OneDrive link to data/code to investigate and reproduce your bug?
Please note that the way you are generating the CSRGraph object is suboptimal. You can generate it directly from a networkx graph with G = cg.csrgraph(G)
with G being a nx.Graph or nx.DiGraph object, and you can also generate it directly from the edgelist with G = cg.read_edgelist('wiki_edgelist.txt', header=None, sep=',')
.
If this bug persists, I'd be happy to fix it if I can reproduce it somehow.
你好
默认情况下,CSRGraph应该可以处理有向图。
您能否给我一个指向数据/代码的OneDrive链接以调查和重现您的错误?
请注意,生成CSRGraph对象的方式不是最佳的。您可以直接从networkx图生成它,
G = cg.csrgraph(G)
其中G是nx.Graph或nx.DiGraph对象,也可以直接从Edgelist生成它G = cg.read_edgelist('wiki_edgelist.txt', header=None, sep=',')
。如果该错误仍然存在,那么如果我可以以某种方式重现它,我将很乐意修复它。
https://github.com/shenweichen/GraphEmbedding/tree/master/data/wiki I used the "Wiki_edgelist.txt" in this program.The original codes are:
import networkx as nx
G=nx.read_edgelist('Wiki_edgelist.txt',create_using = nx.DiGraph(), nodetype = None, data = [('weight', int)])
and then I transformed G to a csrgraph then used the node2vec function to generate nodes embedding but failed..
Thanks I'll take a look and fix it by next week
import csrgraph as cg
import networkx as nx
G = cg.read_edgelist("Wiki_edgelist.txt")
G2 = nx.read_edgelist(
'Wiki_edgelist.txt',
create_using = nx.DiGraph(), nodetype = None, data = [('weight', int)])
G2 = cg.csrgraph(G2)
G.random_walks()
G2.random_walks()
G.ggvec()
G2.ggvec()
This seems to all work on my machine with your data file. Can you confirm?
I found that it's the problem of the version of numba,when I upgrade my numba to 0.52.0,It seems no problem!Perfect work!!
Thanks! I'll close this issue then.
Feel free to raise any other issue you run into