line icon indicating copy to clipboard operation
line copied to clipboard

How to get co-authorship_graph.pkl?

Open ynuwm opened this issue 7 years ago • 6 comments

Can you share the source dataset.

ynuwm avatar Jan 22 '18 07:01 ynuwm

you can see the file in data folder,but i had a problem when i run the code

mellinging avatar Jan 26 '18 09:01 mellinging

AttributeError: 'Graph' object has no attribute '_node'

mellinging avatar Jan 26 '18 09:01 mellinging

@mellinging you can change you version of package networkx, I have the same problem and I try on another PC, this bug missing.

ynuwm avatar Jan 27 '18 02:01 ynuwm

https://pypi.python.org/pypi/networkx/1.9.1 here is the .whl file you can download before you install the old version of networkx, remember to uninstall your latest networkx and then use pip3 install networkx-1.9.1-py2.py3-none-any.whl

ss87021456 avatar Mar 09 '18 19:03 ss87021456

Hello, I wonder whether the output is a graph too, because when I try to draw it using networkx1.9, there are some error in plt

@Uylee you should change version of network if there occurs some errors. you can reference my another answer.

@mellinging you can change you version of package networkx, I have the same problem and I try on another PC, this bug missing.

ynuwm avatar May 25 '20 03:05 ynuwm

Hello, everyone! Here is the link of the official documents for Networkx about how to deal with the version problem: https://networkx.github.io/documentation/latest/release/migration_guide_from_1.x_to_2.0.html

and here is the code below:

in v1.x

pickle.dump([G.nodes(data=True), G.edges(data=True)], file)

then in v2.x

nodes, edges = pickle.load(file)
G = nx.Graph()
G.add_nodes_from(nodes)
G.add_edges_from(edges)

the graphs in 1.x and 2.x are different. So, we need to change the version to 1.x or change the graph given, all will work!!!

Uylee avatar May 25 '20 12:05 Uylee