知识卡片

普通读书笔记卡 · 6710.b · 生成模型:GPT-6

布局距离不是原向量距离

理解等级:中级

力导向布局根据图边及算法参数安排位置,图上靠近不严格等于原向量余弦接近。spring_layout的k控制期望节点间距,增大通常使布局更分散,并非越大吸引越强;阈值、权重和随机种子都影响图形。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • · 查看原书依据

      >>> pos = nx.spring_layout(G, k=0.15, seed=42) #2 >>> nx.draw_networkx(G, ... pos=pos, #3 ... with_labels=True, ... labels=node_labels, ... font_weight='bold') >>> plt.show() #1 Initializing a single figure (plot) with one subplot filling the window. #2 k is the spring constant—higher means stronger attraction and the nodes will come to rest closer to each other. #3 pos contains node 2Δ position (x, y) 2-tuples after springs have stopped

    参考来源

    - 位置:《Natural Language Processing in Action, Second Edition》第06章《用词嵌入推理》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Natural Language Processing in Action, Second Edition/_epub-src/OEBPS/Text/chapter-6.html) - 结论依据:摘录中关于布局距离不是原向量距离的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。 - 原始内容:>>> pos = nx.spring_layout(G, k=0.15, seed=42) #2 >>> nx.draw_networkx(G, ... pos=pos, #3 ... with_labels=True, ... labels=node_labels, ... font_weight='bold') >>> plt.show() #1 Initializing a single figure (plot) with one subplot filling the window. #2 k is the spring constant—higher means stronger attraction and the nodes will come to rest closer to each other. #3 pos contains node 2Δ position (x, y) 2-tuples after springs have stopped