python基础 - networkx 绘图总结

2023-10-26

目录

1、创建方式

2、基本参数

3、DiGraph-有向图

4、Graph-无向图

5、有向图和无向图互转

6、一些精美的图例子


networkx是一个用Python语言开发的图论与复杂网络建模工具,内置了常用的图与复杂网络分析算法,可以方便的进行复杂网络数据分析、仿真建模等工作。
利用networkx可以以标准化和非标准化的数据格式存储网络、生成多种随机网络和经典网络、分析网络结构、建立网络模型、设计新的网络算法、进行网络绘制等。
networkx支持创建简单无向图、有向图和多重图(multigraph);内置许多标准的图论算法,节点可为任意数据;支持任意的边值维度,功能丰富,简单易用。
networkx以图(graph)为基本数据结构。图既可以由程序生成,也可以来自在线数据源,还可以从文件与数据库中读取。

基本流程:
  1. 导入networkx,matplotlib包
  2. 建立网络
  3. 绘制网络 nx.draw()
  4. 建立布局 pos = nx.spring_layout美化作用

1、创建方式

import networkx as nx
import matplotlib.pyplot as plt

# G = nx.random_graphs.barabasi_albert_graph(100, 1)   # 生成一个BA无向图
# G = nx.MultiGraph()     # 有多重边无向图
# G = nx.MultiDiGraph()   # 有多重边有向图
# G = nx.Graph()          # 无多重边无向图
G = nx.DiGraph()          # 无多重边有向图
...
G.clear()  # 清空图

2、基本参数

2.1 networkx 提供画图的函数

  • draw(G,[pos,ax,hold])
  • draw_networkx(G,[pos,with_labels])
  • draw_networkx_nodes(G,pos,[nodelist]) 绘制网络G的节点图
  • draw_networkx_edges(G,pos[edgelist]) 绘制网络G的边图
  • draw_networkx_edge_labels(G, pos[, ...]) 绘制网络G的边图,边有label
  • ---有layout 布局画图函数的分界线---
  • draw_circular(G, **kwargs) Draw the graph G with a circular layout.
  • draw_random(G, **kwargs) Draw the graph G with a random layout.
  • draw_spectral(G, **kwargs) Draw the graph G with a spectral layout.
  • draw_spring(G, **kwargs) Draw the graph G with a spring layout.
  • draw_shell(G, **kwargs) Draw networkx graph with shell layout.
  • draw_graphviz(G[, prog]) Draw networkx graph with graphviz layout.

2.2 networkx 画图参数

nx.draw(G,node_size = 30, with_label = False)

上例,绘制节点的尺寸为30,不带标签的网络图。

  • node_size: 指定节点的尺寸大小(默认是300,单位未知,就是上图中那么大的点)
  • node_color: 指定节点的颜色 (默认是红色,可以用字符串简单标识颜色,例如'r'为红色,'b'为绿色等,具体可查看手册),用“数据字典”赋值的时候必须对字典取值(.values())后再赋值
  • node_shape: 节点的形状(默认是圆形,用字符串'o'标识,具体可查看手册)
  • alpha: 透明度 (默认是1.0,不透明,0为完全透明)
  • width: 边的宽度 (默认为1.0)
  • edge_color: 边的颜色(默认为黑色)
  • style: 边的样式(默认为实现,可选: solid|dashed|dotted,dashdot)
  • with_labels: 节点是否带标签(默认为True)
  • font_size: 节点标签字体大小 (默认为12)
  • font_color: 节点标签字体颜色(默认为黑色)

2.3 networkx 画图函数里的一些参数

  • pos(dictionary, optional): 图像的布局,可选择参数;如果是字典元素,则节点是关键字,位置是对应的值。如果没有指明,则会是spring的布局;也可以使用其他类型的布局,具体可以查阅networkx.layout
  • arrows :布尔值,默认True; 对于有向图,如果是True则会画出箭头
  • with_labels: 节点是否带标签(默认为True)
  • ax:坐标设置,可选择参数;依照设置好的Matplotlib坐标画图
  • nodelist:一个列表,默认G.nodes(); 给定节点
  • edgelist:一个列表,默认G.edges();给定边
  • node_size: 指定节点的尺寸大小(默认是300,单位未知,就是上图中那么大的点)
  • node_color: 指定节点的颜色 (默认是红色,可以用字符串简单标识颜色,例如’r’为红色,'b’为绿色等,具体可查看手册),用“数据字典”赋值的时候必须对字典取值(.values())后再赋值
  • node_shape: 节点的形状(默认是圆形,用字符串’o’标识,具体可查看手册)
  • alpha: 透明度 (默认是1.0,不透明,0为完全透明)
  • cmap:Matplotlib的颜色映射,默认None; 用来表示节点对应的强度
  • vmin,vmax:浮点数,默认None;节点颜色映射尺度的最大和最小值
  • linewidths:[None|标量|一列值];图像边界的线宽
  • width: 边的宽度 (默认为1.0)
  • edge_color: 边的颜色(默认为黑色)
  • edge_cmap:Matplotlib的颜色映射,默认None; 用来表示边对应的强度
  • edge_vmin,edge_vmax:浮点数,默认None;边的颜色映射尺度的最大和最小值
  • style: 边的样式(默认为实现,可选: solid|dashed|dotted,dashdot)
  • labels:字典元素,默认None;文本形式的节点标签
  • font_size: 节点标签字体大小 (默认为12)
  • font_color: 节点标签字体颜色(默认为黑色)
  • node_size:节点大小
  • font_weight:字符串,默认’normal’
  • font_family:字符串,默认’sans-serif’

2.4 布局指定节点排列形式

pos = nx.spring_layout

建立布局,对图进行布局美化,networkx 提供的布局方式有:

  • circular_layout:节点在一个圆环上均匀分布
  • random_layout:节点随机分布
  • shell_layout:节点在同心圆上分布
  • spring_layout: 用Fruchterman-Reingold算法排列节点(这个算法我不了解,样子类似多中心放射状)
  • spectral_layout:根据图的拉普拉斯特征向量排列节

布局也可用pos参数指定,例如,nx.draw(G, pos = spring_layout(G)) 这样指定了networkx上以中心放射状分布.

3、DiGraph-有向图

G = nx.DiGraph()        # 无多重边有向图
G.add_node(2)  # 添加一个节点
G.add_nodes_from([3, 4, 5, 6, 8, 9, 10, 11, 12])  # 添加多个节点
G.add_cycle([1, 2, 3, 4])  # 添加环
G.add_edge(1, 3)  # 添加一条边
G.add_edges_from([(3, 5), (3, 6), (6, 7)])  # 添加多条边
G.remove_node(8)  # 删除一个节点
G.remove_nodes_from([9, 10, 11, 12])  # 删除多个节点
print("nodes: ", G.nodes())  # 输出所有的节点
print("edges: ", G.edges())  # 输出所有的边
print("number_of_edges: ", G.number_of_edges())  # 边的条数,只有一条边,就是(2,3)
print("degree: ", G.degree)  # 返回节点的度
print("in_degree: ", G.in_degree)  # 返回节点的入度
print("out_degree: ", G.out_degree)  # 返回节点的出度
print("degree_histogram: ", nx.degree_histogram(G))  # 返回所有节点的分布序列

输出>>

nodes:  [2, 3, 4, 5, 6, 1, 7]
edges:  [(2, 3), (3, 4), (3, 5), (3, 6), (4, 1), (6, 7), (1, 2), (1, 3)]
number_of_edges:  8
degree:  [(2, 2), (3, 5), (4, 2), (5, 1), (6, 2), (1, 3), (7, 1)]
in_degree:  [(2, 1), (3, 2), (4, 1), (5, 1), (6, 1), (1, 1), (7, 1)]
out_degree:  [(2, 1), (3, 3), (4, 1), (5, 0), (6, 1), (1, 2), (7, 0)]
degree_histogram:  [0, 2, 3, 1, 0, 1]

4、Graph-无向图

4.1 相关函数:

  • all_neighbors(graph, node):返回图中节点的所有邻居
  • non_neighbors(graph, node):返回图中没有邻居的节点
  • common_neighbors(G, u, v):返回图中两个节点的公共邻居
  • non_edges(graph):返回图中不存在的边

# 增加节点
G.add_node('a')  # 添加一个节点1
G.add_nodes_from(['b', 'c', 'd', 'e'])  # 加点集合
G.add_cycle(['f', 'g', 'h', 'j'])  # 加环
H = nx.path_graph(10)  # 返回由10个节点的无向图
G.add_nodes_from(H)  # 创建一个子图H加入G
G.add_node(H)  # 直接将图作为节点

# print("non_edges: ", G.non_edges)  # 返回图中不存在的边
print("all_neighbors: ")  # 返回图中节点的所有邻居
a = nx.all_neighbors(G, "f")
for i, node in enumerate(a):
    print(i, node)

print("non_neighbors: ")  # 返回图中没有邻居的节点
b = nx.non_neighbors(G, "f")
for i, node in enumerate(b):
    print(i, node)

print("common_neighbors: ")  # 返回图中两个节点的公共邻居
c = nx.common_neighbors(G, "j", "g")
for i, node in enumerate(c):
    print(i, node)

print("non_edges: ")  # 返回图中不存在的边
d = nx.non_edges(G)
for i, node in enumerate(d):
    print(i, node)

nx.draw(G, with_labels=True, node_color='red')
plt.show()

 输出>>

all_neighbors: 
0 g
1 j
non_neighbors: 
0 a   1 b   2 c   3 d   4 e   5 h   6 0   7 1   8 2   9
common_neighbors: 
0 h 
1 f
non_edges: 
0 (0, 'g')
1 (0, 'h')
2 (0, 1)
3 (0, 2)
4 (0, 'e')
...太多了

4.2 属性

  • 属性诸如weight,labels,colors,或者任何对象,都可以附加到图、节点或边上。
  • 对于每一个图、节点和边都可以在关联的属性字典中保存一个(多个)键-值对。
  • 默认情况下这些是一个空的字典,但是可以增加或者是改变这些属性。

1、图的属性:

G = nx.Graph(day='Monday')  # 可以在创建图时分配图的属性
print(G.graph)

G.graph['day'] = 'Friday'  # 也可以修改已有的属性
print(G.graph)

G.graph['name'] = 'time'  # 可以随时添加新的属性到图中
print(G.graph)

 输出>>

{'day': 'Monday'}
{'day': 'Friday'}
{'day': 'Friday', 'name': 'time'}

2、节点的属性:

G = nx.Graph(day='Monday')
G.add_node(1, index='1th')  # 在添加节点时分配节点属性
print(G.node(data=True))

G.node[1]['index'] = '0th'  # 通过G.node[][]来添加或修改属性
print(G.node(data=True))

G.add_nodes_from([2, 3], index='2/3th')  # 从集合中添加节点时分配属性
print(G.node(data=True))

输出>>

[(1, {'index': '1th'})]
[(1, {'index': '0th'})]
[(1, {'index': '0th'}), (2, {'index': '2/3th'}), (3, {'index': '2/3th'})]

3、边的属性:

G.add_edge(1, 2, weight=10)  # 在添加边时分配属性
print(G.edges(data=True))

G.add_edges_from([(1, 3), (4, 5)], len=22)  # 从集合中添加边时分配属性
print(G.edges(data='len'))

G.add_edges_from([(3, 4, {'hight': 10}), (1, 4, {'high': 'unknow'})])
print(G.edges(data=True))

G[1][2]['weight'] = 100000  # 通过G[][][]来添加或修改属性
print(G.edges(data=True))

输出>>

[(1, 2, {'weight': 10})]
[(1, 2, None), (1, 3, 22), (4, 5, 22)]
[(1, 2, {'weight': 10}), (1, 3, {'len': 22}), (1, 4, {'high': 'unknow'}), (3, 4, {'hight': 10}), (4, 5, {'len': 22})]
[(1, 2, {'weight': 100000}), (1, 3, {'len': 22}), (1, 4, {'high': 'unknow'}), (3, 4, {'hight': 10}), (4, 5, {'len': 22})]

5、有向图和无向图互转

有向图和多重图的基本操作与无向图一致。
无向图与有向图之间可以相互转换。

G = nx.DiGraph()

H = G.to_undirected()  # 有向图转化成无向图-方法1
H = nx.Graph(G)        # 有向图转化成无向图-方法2

F = H.to_directed()  # 无向图转化成有向图-方法1
F = nx.DiGraph(H)    # 无向图转化成有向图-方法2

6、一些精美的图例子

使用pydot时会遇见如下的错误:

FileNotFoundError: [WinError 2] "twopi" not found in path.

解决参考:

1、 环形树状图

# 环形树状图
import os
import pydot
from networkx.drawing.nx_pydot import graphviz_layout

def set_prog(prog="dot"):
  
    path = r'C:\Program Files (x86)\Graphviz 2.28\bin'  # graphviz的bin目录
    prog = os.path.join(path, prog) + '.exe'
    return prog


G = nx.balanced_tree(3, 5)
pos = graphviz_layout(G, prog=set_prog("twopi"))
plt.figure(figsize=(8, 8))
nx.draw(G, pos, node_size=20, alpha=0.5, node_color="blue", with_labels=False)
plt.axis('equal')
plt.show()

 2、权重图

G = nx.Graph()

G.add_edge('a', 'b', weight=0.6)
G.add_edge('a', 'c', weight=0.2)
G.add_edge('c', 'd', weight=0.1)
G.add_edge('c', 'e', weight=0.7)
G.add_edge('c', 'f', weight=0.9)
G.add_edge('a', 'd', weight=0.3)

elarge = [(u, v) for (u, v, d) in G.edges(data=True) if d['weight'] > 0.5]
esmall = [(u, v) for (u, v, d) in G.edges(data=True) if d['weight'] <= 0.5]

pos = nx.spring_layout(G)  # positions for all nodes

# nodes
nx.draw_networkx_nodes(G, pos, node_size=700)

# edges
nx.draw_networkx_edges(G, pos, edgelist=elarge, width=6)
nx.draw_networkx_edges(G, pos, edgelist=esmall, width=6, alpha=0.5, edge_color='b', style='dashed')

# labels-标签
# nx.draw_networkx_labels(G, pos, font_size=20, font_family='sans-serif')

plt.axis('off')
plt.show()

3、Giant Component 

import pydot
from networkx.drawing.nx_pydot import graphviz_layout


def set_prog(prog="dot"):
    path = r'C:\Program Files (x86)\Graphviz 2.28\bin'  # graphviz的bin目录
    prog = os.path.join(path, prog) + '.exe'
    return prog


pvals = [0.003, 0.006, 0.008, 0.015]  # the range of p values should be close to the threshold

plt.subplots_adjust(left=0, right=1, bottom=0, top=0.95, wspace=0.01, hspace=0.01)
for i, p in enumerate(pvals):
    G = nx.binomial_graph(150, p)  # 150 nodes
    pos = graphviz_layout(G, prog=set_prog("neato"))
    plt.subplot(2, 2, i + 1)
    plt.title("p = %6.3f" % (p,))
    nx.draw(G, pos, with_labels=False, node_size=10)
    # 找出最大连通数的子图
    Gcc = sorted(nx.connected_component_subgraphs(G), key=len, reverse=True)
    G0 = Gcc[0]
    nx.draw_networkx_edges(G0, pos, with_labels=False, edge_color='r', width=6.0)
    # 画出其他连通数子图
    [nx.draw_networkx_edges(Gi, pos, with_labels=False, edge_color='r', alpha=0.3, width=5.0) for Gi in Gcc[1:] if
     len(Gi) > 1]
plt.show()

4、Random Geometric Graph 随机几何图

 
G = nx.random_geometric_graph(200, 0.125)
pos = nx.get_node_attributes(G, 'pos')  # position is stored as node attribute data for random_geometric_graph

# find node near center (0.5,0.5)
dmin = 1
ncenter = 0
for n in pos:
    x, y = pos[n]
    d = (x - 0.5) ** 2 + (y - 0.5) ** 2
    if d < dmin:
        ncenter = n
        dmin = d

# color by path length from node near center
p = dict(nx.single_source_shortest_path_length(G, ncenter))

plt.figure(figsize=(8, 8))
nx.draw_networkx_edges(G, pos, nodelist=[ncenter], alpha=0.4)
nx.draw_networkx_nodes(G, pos, nodelist=list(p.keys()), node_size=80,  node_color=list(p.values()), cmap=plt.cm.Reds_r)

plt.xlim(-0.05, 1.05)
plt.ylim(-0.05, 1.05)
plt.show()

5、节点颜色渐变

G = nx.cycle_graph(24)
pos = nx.spring_layout(G, iterations=200)
nx.draw(G, pos, node_color=range(24), node_size=800, cmap=plt.cm.Blues)
plt.show()

 6、边颜色渐变

G = nx.star_graph(20)
pos = nx.spring_layout(G)  # 布局为中心放射状
colors = range(20)
nx.draw(G, pos, node_color='#A0CBE2', edge_color=colors, width=2, edge_cmap=plt.cm.Blues, with_labels=False)
plt.show()

7、Atlas

import os
import pydot
import random
from networkx.generators.atlas import graph_atlas_g
from networkx.drawing.nx_pydot import graphviz_layout
from networkx.algorithms.isomorphism.isomorph import graph_could_be_isomorphic as isomorphic


def set_prog(prog="dot"):
    path = r'C:\Program Files (x86)\Graphviz 2.28\bin'  # graphviz的bin目录
    prog = os.path.join(path, prog) + '.exe'
    return prog


def atlas6():
    """ Return the atlas of all connected graphs of 6 nodes or less.
        Attempt to check for isomorphisms and remove.
    """

    Atlas = graph_atlas_g()[0:208]  # 208
    # remove isolated nodes, only connected graphs are left
    U = nx.Graph()  # graph for union of all graphs in atlas
    for G in Atlas:
        for n in [n for n in G if G.degree(n) == 0]:
            G.remove_node(n)
        U = nx.disjoint_union(U, G)

    # iterator of graphs of all connected components
    C = (U.subgraph(c) for c in nx.connected_components(U))

    UU = nx.Graph()
    # do quick isomorphic-like check, not a true isomorphism checker
    nlist = []  # list of nonisomorphic graphs
    for G in C:
        # check against all nonisomorphic graphs so far
        if not iso(G, nlist):
            nlist.append(G)
            UU = nx.disjoint_union(UU, G)  # union the nonisomorphic graphs
    return UU


def iso(G1, glist):
    """Quick and dirty nonisomorphism checker used to check isomorphisms."""
    if any(isomorphic(G1, G2) for G2 in glist):
        return True
    return False


G = atlas6()
print("graph has %d nodes with %d edges" % (nx.number_of_nodes(G), nx.number_of_edges(G)))
print(nx.number_connected_components(G), "connected components")
plt.figure(1, figsize=(8, 8))
pos = graphviz_layout(G, prog=set_prog("neato"))
# color nodes the same in each connected subgraph
C = (G.subgraph(c) for c in nx.connected_components(G))
for g in C:
    c = [random.random()] * nx.number_of_nodes(g)  # random color...
    nx.draw(g, pos, node_size=40, node_color=c, vmin=0.0, vmax=1.0, with_labels=False)
plt.show()

8、Club

import networkx.algorithms.bipartite as bipartite

G = nx.davis_southern_women_graph()
women = G.graph['top']
clubs = G.graph['bottom']

print("Biadjacency matrix")
print(bipartite.biadjacency_matrix(G, women, clubs))

# project bipartite graph onto women nodes
W = bipartite.projected_graph(G, women)
print('')
print("#Friends, Member")
for w in women:
    print('%d %s' % (W.degree(w), w))

# project bipartite graph onto women nodes keeping number of co-occurence
# the degree computed is weighted and counts the total number of shared contacts
W = bipartite.weighted_projected_graph(G, women)
print('')
print("#Friend meetings, Member")
for w in women:
    print('%d %s' % (W.degree(w, weight='weight'), w))

nx.draw(G, node_color="red")
plt.show()

 


参考:

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

python基础 - networkx 绘图总结 的相关文章

随机推荐

  • 深度负反馈

    负反馈放大电路的方块图 因为负反馈放大电路有四种组态 而且对于同一种组态 具体电路也各不相同 所以为了研究负反馈放大电路的共同规律 可以利用方块图来描述所有电路 一 负反馈放大电路的方块图表示法 任何负反馈放大电路都可以用下图所示的方块图来
  • windows服务器禁用135,137,138,139,445端口方法

    windows服务器禁用135 137 138 139 445端口方法 1 防火墙新建入站和出站规则 注意 此方法只针对防火墙已开启的情况下才能实现禁用端口 打开控制面板 系统和安全 Windows Defender 防火墙 在左侧选择 高
  • 安装Apache Hive-2.3.3

    1 Hive是什么 1 1 Hive是数据仓库 数据仓库英文名DataWarehouse 可简写为DW或DWH 数据仓库 由数据仓库之父比尔 恩门 Bill Inmon 于1990年提出 主要功能仍是将组织透过资讯系统之联机事务处理 OLT
  • 【H.264/AVC视频编解码技术详解】十七:帧内预测编码的预测实现方法

    H 264 AVC视频编解码技术详解 视频教程已经在 CSDN学院 上线 视频中详述了H 264的背景 标准协议和实现 并通过一个实战工程的形式对H 264的标准进行解析和实现 欢迎观看 纸上得来终觉浅 绝知此事要躬行 只有自己按照标准文档
  • pandas.read_csv参数整理

    pandas read csv参数整理 转载 读取CSV 逗号分割 文件到DataFrame 也支持文件的部分导入和选择迭代 更多帮助参见 http pandas pydata org pandas docs stable io html
  • 如何当个优秀的文档工程师?从 TC China 看技术文档工程师的自我修养

    本文系 NebulaGraph Community Academic 技术文档工程师 Abby 的参会观感 讲述了她在中国技术传播大会分享的收获以及感悟 据说 技术内容领域 传播领域的专家和决策者们会在中国技术传播大会 tcworld Ch
  • 实施静态分析并非易事

    针对软件错误和漏洞的静态分析测试 SAST 应该成为应用程序安全性和软件质量程序的一部分 您需要做的就是运行一个工具 它将在开发的早期发现价格便宜且易于修复的错误 听起来很简单 但是 这不仅需要购买工具并运行扫描 还需要将代码上传到测试服务
  • 【云原生】Docker镜像、容器、仓库、配置等常见问题汇总(面试必看)

    Docker 常见问题整理汇总 本文目录 一 镜像相关 二 容器相关 三 仓库相关 四 配置相关 五 Docker与虚拟化 六 其它常见问题 一 镜像相关 1 如何批量清理临时镜像文件 可以使用sudo docker rmi sudo do
  • C++入门基础07:函数定义与声明、函数传参(传值、传地址、传引用)、函数重载

    C 入门基础07 函数定义与声明 函数传参 传值 传地址 传引用 函数重载 1 函数定义与声明 函数是一起执行一个任务的一组语句 每个程序 C C 都有一个主函数 main 所有简单的程序都可以定义其他额外的函数 可以把代码划分到不同的函数
  • 上位机发送FINS UDP命令读写欧姆龙PLC数据

    上位机通过发送FINS UDP命令读写欧姆龙PLC内部数据 可以用于上位机socket通讯测试 客户服务中心 打开 Sockettool软件 新建一个UDP客户端 HTcP TIP urIEl调试工具W 创 H隊 是出 H TCP H TC
  • 服务器物理内存总是九十几,服务器物理内存使用率90以上

    服务器物理内存使用率90以上 内容精选 换一换 开启弹性云服务器的虚拟内存后 会导致硬盘I O性能下降 因此 平台提供的Windows弹性云服务器默认未配置虚拟内存 如果弹性云服务器内存不足 建议通过 变更规格 操作来扩大内存 如果业务需要
  • 时空编解码器残差多图卷积网络预测OD客流需求

    paper title Predicting origin destination ride sourcing demand with a spatio temporal encoder decoder residual multi gra
  • windows下调用系统API实现进程创建和文件读写

    题目要求 有一个文本文件CommandList txt 第一行是说明文字 本文件最后一次打开和运行日期是20150407 第二行开始每行是一个可执行程序的名称 含路径 编写一个应用程序能打开该文件 并顺序执行其中的每个程序 并更新文件第一行
  • stm32+hx711+称重传感器

    本项目使用主控stm32f103c8t6 最小系统核心板 称重模块hx711 串口打印到电脑端显示数值 这个传感器内部是一组半桥应变片 使用方法可以有以下三种 1 使用一只传感器配合外接电阻组成全桥测量 量程为一个传感器的量程 50kg 对
  • Python 工匠:编写条件分支代码的技巧

    欢迎大家前往腾讯云 社区 获取更多腾讯海量技术实践干货哦 本文由鹅厂优文发表于云 社区专栏 作者 朱雷 腾讯IEG高级工程师 Python 工匠 是什么 我一直觉得编程某种意义是一门 手艺 因为优雅而高效的代码 就如同完美的手工艺品一样让人
  • 2017年总结和2018年规划(几年前帖子,私密变公开后时间就变了)

    2017年浑浑噩噩 一直处于摇摆不定的局面 2018年重新找了个工作 必须要努力啦 月薪16000 图形还是要和师兄这边搞搞UE4 图像这边学学计算机视觉 希望能通过试用期 加油
  • 左程云算法笔记025

    map和哈希map的使用 cpp 此文件包含 main 函数 程序执行将在此处开始并结束 include
  • LINUX下查看点云图————point cloud(.ply .vtk .pcd)

    首先 你要确定点云的格式 pcd vtk 还是 ply 如果是 pcd vtk 那么可以用pcl工具查看 1 安装pcl 官网链接点击打开链接 sudo add apt repository ppa v launchpad jochen s
  • python可使用什么退出死循环_碰到python死循环后要怎么退出结束?

    每当编写代码行云流水 却突然碰到代码无限循环 这是非常让人头疼的 难道直接退出程序运行嘛 答案肯定是不行 怎么跳出呢 一起来看下吧 案例 遇到的问题是这样的 如果我定义了一个死循环线程我该如何终止它 我发现用全局变量的方法根本不好使 pys
  • python基础 - networkx 绘图总结

    目录 1 创建方式 2 基本参数 3 DiGraph 有向图 4 Graph 无向图 5 有向图和无向图互转 6 一些精美的图例子 networkx是一个用Python语言开发的图论与复杂网络建模工具 内置了常用的图与复杂网络分析算法 可以