You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
When running the example: AttributeError: module 'community' has no attribute 'best_partition' #4
Hi!
Thanks for publishing the code and the data from your paper! I am trying to experiment with the example code provided in the README file but I get an error when I run describe_communities_with_plots_complex(G, N=6, data_dir=data_dir_output). Here is the traceback:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[19], line 23
17 node_embeddings = load_embeddings(f'{data_dir}/{embedding_file}')
19 visualize_embeddings_2d_pretty_and_sample(node_embeddings,
20 n_clusters=10, n_samples=10,
21 data_dir=data_dir_output, alpha=.7)
---> 23 describe_communities_with_plots_complex(G, N=6, data_dir=data_dir_output)
File ~/anaconda3/envs/repox-llm-new/lib/python3.11/site-packages/GraphReasoning/graph_analysis.py:470, in describe_communities_with_plots_complex(G, N, N_nodes, data_dir)
459 """
460 Detect and describe the top N communities in graph G based on key nodes, with integrated plots.
461 Adds separate plots for average node degree, average clustering coefficient, and betweenness centrality over all communities.
(...)
467 - data_dir (str): Directory to save the plots.
468 """
469 # Detect communities using the Louvain method
--> 470 partition = community_louvain.best_partition(G)
472 # Invert the partition to get nodes per community
473 communities = {}
AttributeError: module 'community' has no attribute 'best_partition'
Also, in the same example code, there is no name provided for the tokenizer_model to use in embedding_tokenizer = AutoTokenizer.from_pretrained(tokenizer_model, ) . I used tokenizer_model = 'BAAI/bge-large-en-v1.5' as I read in your paper that this is the model you have used. I just wanted to mention it so you might consider adding it in the example code.
Activity
terilias commentedon Jul 29, 2024
If I am understand correctly, now I found that this issue is duplicated with issue #1
qspang commentedon Nov 27, 2024
Obviously issue1 is not solved, and the proposed solution does not solve the problem.
qspang commentedon Nov 27, 2024
I find the solution.Combine the changes mentioned above with the reload mentioned in this link:taynaud/python-louvain#48
terilias commentedon Nov 27, 2024
@qspang thanks for the update!
SamanehShamshiri1 commentedon Apr 10, 2025
@terilias Hi, Could you run the code? I'm wondering if you could run the code on your own dataset
qspang commentedon Apr 15, 2025
@SamanehShamshiri Sure
SamanehShamshiri1 commentedon Apr 15, 2025
@qspang would you please share your email with my, I would like to ask some question about the code, thank you so much
qspang commentedon Apr 15, 2025
@SamanehShamshiri superpqs@gmail.com