Giter Club home page Giter Club logo

Comments (16)

xmweijh avatar xmweijh commented on June 4, 2024

①不知道你说的是哪个算法的代码,但可视化应该都差不多,一些算法中有可视化代码,你可以参考下。
②你要对中文进行聚类吗?首先要中文数据转换为图数据,可以通过word2vec算法进行表示,计算相似度,设置阈值,大于阈值的看做相邻的两点,从而得到图数据。然后就可以用图聚类(社区检测)算法了。

from communitydetection.

1101Yang1101 avatar 1101Yang1101 commented on June 4, 2024

from communitydetection.

xmweijh avatar xmweijh commented on June 4, 2024

①哦哦,我当时换比较大的数据集测试所以注释了,因为可视化中函数中颜色不够,你稍微修改下代码就行,如果用空手道数据集可以直接可视化。
②可以参考这个代码:https://github.com/bojone/infomap/blob/master/word_cluster.py

from communitydetection.

1101Yang1101 avatar 1101Yang1101 commented on June 4, 2024

(1)方便请教一下怎么改代码吗,那个图它是会直接在pycharm运行结束后自己弹出来吗。或者有没有可能把运行出来的结果导入gephi啥的也能画图/不好意思,我的编程水平是hello world的程度/笑哭
(2)谢谢!我下去学学!

from communitydetection.

xmweijh avatar xmweijh commented on June 4, 2024

会直接跳出来,你就把我注释的改一下。
'
if name == 'main':
G = load_graph('data/club.txt')
# G = load_graph('data/OpenFlights.txt')
obj = Graph()
# G1 = obj.createGraph("Data//OpenFlights.txt")
G1 = nx.karate_club_graph()
pos = nx.spring_layout(G1)
start_time = time.time()
algorithm = Louvain(G)
communities = algorithm.execute()
end_time = time.time()
# 按照社区大小从大到小排序输出
communities = sorted(communities, key=lambda b: -len(b)) # 按社区大小排序
count = 0
for communitie in communities:
count += 1
print("社区", count, " ", communitie)

print(cal_Q(communities, G1))
print(f'算法执行时间{end_time - start_time}')
# 可视化结果
showCommunity(G1, communities, pos)

'
如果要用大数据集,就去showCommunity中添加color和shape

from communitydetection.

1101Yang1101 avatar 1101Yang1101 commented on June 4, 2024

谢谢您!它现在在报错,我先下去改改试试!

from communitydetection.

1101Yang1101 avatar 1101Yang1101 commented on June 4, 2024

谢谢大佬!我成功了!还想请问一下showcommunity是什么呀,网页上我找不到~

稍微调了下全半角啥的贴在这里
if name == 'main':
G = load_graph('data/club.txt')
# G = load_graph('data/OpenFlights.txt')
obj = Graph()
# G1 = obj.createGraph(“Data//OpenFlights.txt”)
G1 = nx.karate_club_graph()
pos = nx.spring_layout(G1)
start_time = time.time()
algorithm = Louvain(G)
communities = algorithm.execute()
end_time = time.time()
# 按照社区大小从大到小排序输出
社区 = sorted(communities, key=lambda b: -len(b)) # 按社区大小排序
count = 0
for communitie in communities:
count += 1
print('社区', count, '' , communitie)

from communitydetection.

xmweijh avatar xmweijh commented on June 4, 2024

就是louvain算法中写的那个可视化函数啊😂

from communitydetection.

1101Yang1101 avatar 1101Yang1101 commented on June 4, 2024

懂了懂了,看到了!我还以为是什么工具来着。感谢有您!好人一生平安!!

from communitydetection.

1101Yang1101 avatar 1101Yang1101 commented on June 4, 2024

大佬,请问这有没有可能实现给每个节点都自定义命名(而不是标123),以及一个节点的大小和这个节点对其他节点的影响力(大概是这个意思)成正比嘞~我刚学了下pajek,那个貌似可以做,但是那个还得自己去生成net数据,感觉不太行……

from communitydetection.

xmweijh avatar xmweijh commented on June 4, 2024

networkx可以做到这些 ,节点名字给节点添加特征就行,节点大小在绘制时候nx.draw设置node_size

from communitydetection.

1101Yang1101 avatar 1101Yang1101 commented on June 4, 2024

networkx可以做到这些 ,节点名字给节点添加特征就行,节点大小在绘制时候nx.draw设置node_size

感谢!我昨天学到了pajek+VOSviewer的处理方法

from communitydetection.

13016571566 avatar 13016571566 commented on June 4, 2024

感谢感谢,请教一下我运行spla.py,不加可视化是对的,想用可视化,把备注改一下就报错了,纯小白不太会改

from communitydetection.

xmweijh avatar xmweijh commented on June 4, 2024

不好意思,我没写重叠社区的可视化函数,所以确实不能用。

from communitydetection.

13016571566 avatar 13016571566 commented on June 4, 2024

哦哦好的好的,谢谢您

from communitydetection.

LBJgigigi avatar LBJgigigi commented on June 4, 2024

想求教这个louvain算法的整个流程讲解,我需要对其进行改进,有偿求教,微信号LBJgigigi13

from communitydetection.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.