跳到内容

igraph 选项

igraph_options() igraph_opt()
igraph 包的参数
with_igraph_opt()
使用临时 igraph 选项设置运行代码

构造

确定性构造函数

connect() ego_size() neighborhood_size() ego() neighborhood() make_ego_graph() make_neighborhood_graph()
图顶点的邻域
make_()
创建一个新图
make_bipartite_graph() bipartite_graph()
创建二分图
make_chordal_ring() chordal_ring()
创建扩展的弦环图
make_clusters()
创建一个社团对象。
make_de_bruijn_graph() de_bruijn_graph()
德布鲁因图
make_empty_graph() empty_graph()
一个没有边的图
make_from_prufer() from_prufer()
从其 Prüfer 序列创建一个无向树图
make_full_bipartite_graph() full_bipartite_graph()
创建一个完全二分图
make_full_citation_graph() full_citation_graph()
创建一个完整的(完全)引用图
make_full_graph() full_graph()
创建一个完整图
make_graph() make_directed_graph() make_undirected_graph() directed_graph() undirected_graph()
从边列表或著名图创建一个 igraph 图
make_kautz_graph() kautz_graph()
考茨图
make_lattice() lattice()
创建晶格图
make_line_graph() line_graph()
图的线图
make_ring() ring()
创建一个环图
make_star() star()
创建一个星图,一个具有 n 个顶点和 n - 1 个叶子的树
make_tree() tree()
创建树图
realize_degseq()
从给定的度序列确定性地创建一个图
realize_bipartite_degseq() 实验性
从两个度序列确定性地创建一个二分图
graph_from_atlas() atlas()
从图谱创建图
graph_from_edgelist() from_edgelist()
从边列表矩阵创建一个图
graph_from_literal() from_literal()
通过简单接口创建(小)图
graph_()
将对象转换为图
graph_from_lcf()
从 LCF 符号创建图
as_data_frame() graph_from_data_frame() from_data_frame()
从数据框创建 igraph 图或反之

随机构造函数(随机图模型)

sample_()
从随机图模型中采样
sample_bipartite() bipartite() 已弃用
二分随机图
bipartite_gnm() bipartite_gnp() sample_bipartite_gnm() sample_bipartite_gnp()
二分随机图
sample_chung_lu() chung_lu() 实验性
具有给定预期度的随机图
sample_correlated_gnp()
通过随机添加/删除边从给定图生成一个新的随机图
sample_correlated_gnp_pair()
采样一对相关的 \(G(n,p)\) 随机图
sample_degseq() degseq()
生成具有给定度序列的随机图
sample_dot_product() dot_product()
根据随机点积图模型生成随机图
sample_fitness()
来自顶点适应度分数的随机图
sample_fitness_pl()
来自顶点适应度分数的无标度随机图
sample_forestfire()
森林火灾网络模型
sample_gnm() gnm()
根据 \(G(n,m)\) Erdős-Rényi 模型生成随机图
sample_gnp() gnp()
根据 \(G(n,p)\) Erdős-Rényi 模型生成随机图
sample_grg() grg()
几何随机图
sample_growing() growing()
生长随机图生成
sample_hierarchical_sbm() hierarchical_sbm()
采样分层随机块模型
sample_islands()
具有子图的图,每个子图都是一个随机图。
sample_k_regular()
创建一个随机正则图
sample_last_cit() last_cit() sample_cit_types() cit_types() sample_cit_cit_types() cit_cit_types()
随机引用图
sample_pa() pa()
使用优先连接生成随机图
sample_pa_age() pa_age()
生成具有优先连接和老化的演化随机图
sample_pref() pref() sample_asym_pref() asym_pref()
基于特征的随机生成
sample_sbm() sbm()
采样随机块模型
sample_smallworld() smallworld()
Watts-Strogatz 小世界模型
sample_traits_callaway() traits_callaway() sample_traits() traits()
基于不同顶点类型的图生成
sample_tree()
随机且均匀地采样树

构造函数修饰符

make_()
创建一个新图
sample_()
从随机图模型中采样
simplified()
构造函数修饰符,用于删除多个和循环边
with_edge_()
构造函数修饰符,用于添加边属性
with_graph_()
构造函数修饰符,用于添加图属性
with_vertex_()
构造函数修饰符,用于添加顶点属性
without_attr()
构造函数修饰符,用于从图中删除所有属性
without_loops()
构造函数修饰符,用于删除循环边
without_multiples()
构造函数修饰符,用于删除多个边

转换为 igraph

as.igraph()
转换为 igraph

邻接矩阵

可视化

add_layout_()
向图中添加布局
component_wise()
分量布局
layout_() print(<igraph_layout_spec>) print(<igraph_layout_modifier>)
图布局
layout_as_bipartite() as_bipartite()
二分图的简单两行布局
layout_as_star() as_star()
生成坐标以将图的顶点放置在星形中
layout_as_tree() as_tree()
Reingold-Tilford 图布局算法
layout_in_circle() in_circle()
顶点位于圆上的图布局。
layout_nicely() nicely()
自动选择合适的图布局算法
layout_on_grid() on_grid()
简单网格布局
layout_on_sphere() on_sphere()
顶点位于球体表面的图布局
layout_randomly() randomly()
将顶点随机放置在平面或 3D 空间中
layout_with_dh() with_dh()
Davidson-Harel 布局算法
layout_with_fr() with_fr()
Fruchterman-Reingold 布局算法
layout_with_gem() with_gem()
GEM 布局算法
layout_with_graphopt() with_graphopt()
graphopt 布局算法
layout_with_kk() with_kk()
Kamada-Kawai 布局算法
layout_with_lgl() with_lgl()
大型图布局
layout_with_mds() with_mds()
通过多维缩放进行图布局
layout_with_sugiyama() with_sugiyama()
Sugiyama 图布局生成器
merge_coords() layout_components()
合并图布局
norm_coords()
规范化用于绘制图的坐标
normalize()
规范化布局
layout_with_drl() with_drl()
DrL 图布局生成器
categorical_pal()
类别的调色板
diverging_pal()
发散调色板
r_pal()
默认的 R 调色板
sequential_pal()
顺序调色板
plot(<igraph>)
图的绘制
rglplot()
使用 OpenGL 绘制 3D 图
plot.common igraph.plotting
绘制图
plot_dendrogram(<igraphHRG>)
HRG 树状图绘制
plot_dendrogram()
社团结构树状图绘制
curve_multiple()
绘制图时的最佳边曲率
shapes() shape_noclip() shape_noplot() add_shape()
绘制 igraph 图时各种顶点形状
vertex.shape.pie
在图绘制中使用饼图作为顶点
align_layout()
对齐顶点布局 此函数将顶点布局居中于坐标系原点,并旋转布局以实现与坐标轴在视觉上令人愉悦的对齐。 对于诸如 layout_with_fr() 等力导向布局,这样做特别有用。

图着色

greedy_vertex_coloring()
贪婪顶点着色

用于操作图的函数

add_edges()
向图添加边
add_vertices()
向图中添加顶点
complementer()
图的补图
compose()
将两个图组合为二元关系
contract()
将多个顶点收缩为一个顶点
delete_edges()
从图中删除边
delete_vertices()
从图中删除顶点
difference()
两组的差集
difference(<igraph>)
图的差
disjoint_union() `%du%`
图的不相交并集
edge() edges()
用于添加和删除边的辅助函数
connect() ego_size() neighborhood_size() ego() neighborhood() make_ego_graph() make_neighborhood_graph()
图顶点的邻域
`-`(<igraph>)
从图中删除顶点或边
intersection()
两个或多个集合的交集
intersection(<igraph>)
图的交集
path()
沿路径添加或删除边的辅助函数
permute()
排列图的顶点
`+`(<igraph>)
将顶点、边或另一个图添加到图中
rep(<igraph>) `*`(<igraph>)
多次复制图
reverse_edges() t(<igraph>)
反转图中的边
simplify() is_simple() simplify_and_colorize()
简单图
union()
两个或多个集合的并集
union(<igraph>)
图的并集
vertex() vertices()
用于添加和删除顶点的辅助函数

重连函数

each_edge()
将图的边的端点重连到随机顶点
keeping_degseq()
在保持度分布的同时重连图
rewire()
重连图的边

顶点、边和图属性

delete_edge_attr()
删除边属性
delete_graph_attr()
删除图属性
delete_vertex_attr()
删除顶点属性
`edge_attr<-`()
设置一个或多个边属性
edge_attr()
查询图的边属性
edge_attr_names()
列出边属性的名称
`graph_attr<-`()
设置所有或部分图属性
graph_attr()
图的图属性
graph_attr_names()
列出图属性的名称
igraph-attribute-combination attribute.combination
当图更改时,igraph 函数如何处理属性
`$`(<igraph>) `$<-`(<igraph>)
获取和设置图属性,快捷方式
`[[<-`(<igraph.vs>) `[<-`(<igraph.vs>) `$`(<igraph.vs>) `$<-`(<igraph.vs>) `V<-`()
查询或设置顶点序列中顶点的属性
set_edge_attr()
设置边属性
set_graph_attr()
设置图属性
set_vertex_attr()
设置顶点属性
set_vertex_attrs()
设置多个顶点属性
`vertex_attr<-`()
设置一个或多个顶点属性
vertex_attr()
查询图的顶点属性
vertex_attr_names()
列出顶点属性的名称

顶点和边序列

E()
图的边
V()
图的顶点
as_ids()
将顶点或边序列转换为普通向量
`[[<-`(<igraph.es>) `[<-`(<igraph.es>) `$`(<igraph.es>) `$<-`(<igraph.es>) `E<-`()
查询或设置边序列中边的属性
`[`(<igraph.es>)
索引边序列
`[[`(<igraph.es>)
选择边并显示其元数据
`[[<-`(<igraph.vs>) `[<-`(<igraph.vs>) `$`(<igraph.vs>) `$<-`(<igraph.vs>) `V<-`()
查询或设置顶点序列中顶点的属性
`[`(<igraph.vs>)
索引顶点序列
`[[`(<igraph.vs>)
选择顶点并显示其元数据
print(<igraph.es>)
将边序列打印到屏幕
print(<igraph.vs>)
在屏幕上显示顶点序列
c(<igraph.es>)
连接边序列
c(<igraph.vs>)
连接顶点序列
difference(<igraph.es>)
边序列的差
difference(<igraph.vs>)
顶点序列的差
intersection(<igraph.es>)
边序列的交集
intersection(<igraph.vs>)
顶点序列的交集
rev(<igraph.es>)
反转边序列中的顺序
rev(<igraph.vs>)
反转顶点序列中的顺序
union(<igraph.es>)
边序列的并集
union(<igraph.vs>)
顶点序列的并集
unique(<igraph.es>)
从边序列中删除重复的边
unique(<igraph.vs>)
从顶点序列中删除重复的顶点

实用程序

图 ID、比较、名称、权重

graph_id()
获取图的 ID
identical_graphs()
确定两个图是否相同
is_igraph()
此对象是 igraph 图吗?
is_named()
命名图
is_weighted()
加权图
is_chordal()
图的弦性

转换

as.matrix(<igraph>)
将 igraph 对象转换为邻接矩阵或边列表矩阵
as_adj_list() as_adj_edge_list()
邻接列表
as_adjacency_matrix()
将图转换为邻接矩阵
as_biadjacency_matrix()
二分图的二分邻接矩阵
as_directed() as_undirected()
在有向图和无向图之间转换
as_edgelist()
将图转换为边列表
as_graphnel()
将 igraph 图转换为 graph 包中的 graphNEL 对象
as_long_data_frame()
将图转换为长数据框
graph_from_adj_list()
从邻接列表创建图
as_data_frame() graph_from_data_frame() from_data_frame()
从数据框创建 igraph 图或反之
graph_from_graphnel()
将 graph 包中的 graphNEL 对象转换为 igraph

Env 和数据

dot-data .data dot-env .env
.data.env 代词

打印

head_print()
仅打印 R 对象的头部
indent_print()
缩进打印输出
print(<igraph>) summary(<igraph>)
将图打印到终端
is_printer_callback()
这是一个打印机回调吗?
printer_callback()
创建打印机回调函数

潜在位置向量采样器

sample_dirichlet()
从狄利克雷分布中采样
sample_sphere_surface()
从球体表面均匀采样向量
sample_sphere_volume()
从球体体积均匀采样向量

其他

convex_hull()
一组顶点的凸包
running_mean()
时间序列的运行平均值
sample_seq()
采样随机整数序列
fit_power_law()
将幂律分布函数拟合到离散数据

结构属性

bfs()
广度优先搜索
component_distribution() largest_component() components() is_connected() count_components()
图的连通分量
constraint()
Burt 的约束
coreness()
图的 K 核分解
degree() max_degree() degree_distribution()
顶点的度和度分布
dfs()
深度优先搜索
distance_table() mean_distance() distances() shortest_paths() all_shortest_paths()
顶点之间的最短(有向或无向)路径
edge_density()
图密度
connect() ego_size() neighborhood_size() ego() neighborhood() make_ego_graph() make_neighborhood_graph()
图顶点的邻域
feedback_arc_set()
在图中查找反馈弧集
feedback_vertex_set() 实验性
在图中查找反馈顶点集
girth()
图的围长
is_acyclic()
无环图
is_dag()
有向无环图
k_shortest_paths()
查找两个顶点之间的 \(k\) 条最短路径
knn()
平均最近邻度
is_matching() is_max_matching() max_bipartite_match()
匹配
reciprocity()
图的互反性
subcomponent()
顶点的内分量或外分量
subgraph() induced_subgraph() subgraph_from_edges()
图的子图
topo_sort()
图中顶点的拓扑排序
transitivity()
图的传递性
unfold_tree()
将通用图转换为森林
which_multiple() any_multiple() count_multiple() which_loop() any_loop()
在图中查找多个或循环边
which_mutual()
在有向图中查找互连边
cocitation() bibcoupling()
共引用耦合
similarity()
两个顶点的相似性度量
cohesive_blocks() length(<cohesiveBlocks>) blocks() graphs_from_cohesive_blocks() cohesion(<cohesiveBlocks>) hierarchy() parent() print(<cohesiveBlocks>) summary(<cohesiveBlocks>) plot(<cohesiveBlocks>) plot_hierarchy() export_pajek() max_cohesion()
计算凝聚块
triangles() count_triangles()
在图中查找三角形
assortativity() assortativity_nominal() assortativity_degree()
选型系数
spectrum()
图的邻接矩阵的特征值和特征向量

矩阵

laplacian_matrix()
图拉普拉斯算子
as_adjacency_matrix()
将图转换为邻接矩阵
stochastic_matrix()
图的随机矩阵

弦图

is_chordal()
图的弦性
max_cardinality()
最大基数搜索

三角形和传递性

triangles() count_triangles()
在图中查找三角形
transitivity()
图的传递性

路径

all_simple_paths()
列出从一个源的所有简单路径
diameter() get_diameter() farthest_vertices()
图的直径
distance_table() mean_distance() distances() shortest_paths() all_shortest_paths()
顶点之间的最短(有向或无向)路径
eccentricity()
图中顶点的离心率
graph_center() 实验性
图的中心顶点
radius()
图的半径

二分图

bipartite_mapping()
确定图是否为二分图
bipartite_projection() bipartite_projection_size()
投影二分图
is_bipartite()
检查图是否具有名为 type 的顶点属性。
make_bipartite_graph() bipartite_graph()
创建二分图
graph_from_biadjacency_matrix()
从二分邻接矩阵创建图
as_data_frame() graph_from_data_frame() from_data_frame()
从数据框创建 igraph 图或反之

效率

相似性

similarity()
两个顶点的相似性度量

is_forest()
确定图是否为森林。
is_tree()
确定图是否为树。
make_from_prufer() from_prufer()
从其 Prüfer 序列创建一个无向树图
sample_spanning_tree()
从图的生成树中随机且均匀地采样
to_prufer()
将树图转换为其 Prüfer 序列
mst()
最小生成树

结构查询

adjacent_vertices()
图中多个顶点的相邻顶点
are_adjacent()
两个顶点是否相邻?
ends()
一些图边的关联顶点
get_edge_ids()
基于边的关联顶点查找边的 ID
vcount() gorder()
图的阶数(顶点数)
gsize() ecount()
图的大小(边数)
head_of()
图中边的头部
incident()
图中顶点的关联边
incident_edges()
图中多个顶点的关联边
is_directed()
检查图是否有向
neighbors()
图中的相邻(邻接)顶点
`[`(<igraph>)
像邻接矩阵一样查询和操作图
`[[`(<igraph>)
像邻接列表一样查询和操作图
tail_of()
图中边的尾部

ARPACK 特征向量计算

arpack_defaults() arpack()
ARPACK 特征向量计算

中心性度量

alpha_centrality()
查找网络位置的 Bonacich alpha 中心性分数
betweenness() edge_betweenness()
顶点和边介数中心性
closeness()
顶点的接近中心性
diversity()
图多样性
eigen_centrality()
顶点的特征向量中心性
harmonic_centrality()
顶点的调和中心性
hits_scores()
Kleinberg 的枢纽和权威中心性分数。
authority_score() hub_score()
Kleinberg 的权威中心性分数。
page_rank()
Page Rank 算法
power_centrality()
查找网络位置的 Bonacich 幂中心性分数
spectrum()
图的邻接矩阵的特征值和特征向量
strength()
强度或加权顶点度
subgraph_centrality()
查找网络位置的子图中心性分数

中心化

centr_betw()
根据顶点的介数中心化图
centr_betw_tmax()
介数中心化的理论最大值
centr_clo()
根据顶点的接近程度中心化图
centr_clo_tmax()
接近程度中心化的理论最大值
centr_degree()
根据顶点的度中心化图
centr_degree_tmax()
度中心化的理论最大值
centr_eigen()
根据顶点的特征向量中心性中心化图
centr_eigen_tmax()
特征向量中心化的理论最大值
centralize()
图的中心化

扫描统计

local_scan()
计算图上的局部扫描统计
scan_stat()
图的时间序列上的扫描统计

图模体和子图

count_motifs()
图模体
dyad_census()
图的二元组普查
motifs()
图模体
sample_motifs()
图模体
triad_census()
三元组普查,具有三个顶点的子图

图同构

canonical_permutation()
图的规范排列
count_isomorphisms()
计算两个图之间同构映射的数量
count_subgraph_isomorphisms()
计算一个图与另一个图的子图之间的同构映射
graph_from_isomorphism_class()
从同构类创建一个图
isomorphic() is_isomorphic_to()
确定两个图是否同构
isomorphism_class()
图的同构类
isomorphisms()
计算两个图的顶点之间的所有同构映射
subgraph_isomorphic() is_subgraph_isomorphic_to()
确定一个图是否与另一个图的子图同构
subgraph_isomorphisms()
一个图与另一个图的子图之间的所有同构映射
simplify() is_simple() simplify_and_colorize()
简单图
automorphism_group()
图的自同构群的生成集
count_automorphisms()
自同构的数量
permute()
排列图的顶点

图匹配

match_vertices()
给定顶点对应关系的种子匹配图

最大流和连通性

dominator_tree()
支配树
edge_connectivity() edge_disjoint_paths() adhesion()
边连通性
is_min_separator()
最小顶点分隔符
is_separator()
检查删除此顶点集是否会断开图的连接。
max_flow()
图中的最大流量
min_cut()
图中的最小割
min_separators()
最小大小的顶点分隔符
min_st_separators()
最小大小的顶点分隔符
st_cuts()
列出图的所有 (s,t)-割
st_min_cuts()
列出图的所有最小 \((s,t)\)-割
vertex_connectivity() vertex_disjoint_paths() cohesion(<igraph>)
顶点连通性

cliques() largest_cliques() max_cliques() count_max_cliques() clique_num() largest_weighted_cliques() weighted_clique_num() clique_size_counts() is_clique()
查找团的函数,即图中的完整子图
is_complete()
这是一个完整的图吗?
ivs() largest_ivs() max_ivs() ivs_size() independence_number() is_ivs()
独立顶点集
weighted_cliques()
用于查找加权团的函数,即图中顶点加权的完全子图
graphlet_basis() graphlet_proj() graphlets()
图的Graphlet分解

社区检测

as_membership()
将数值向量声明为成员向量
cluster_edge_betweenness()
基于边介数的社区结构检测
cluster_fast_greedy()
通过模块化贪婪优化实现社区结构
cluster_fluid_communities()
基于交互流体的社区检测算法
cluster_infomap()
Infomap社区发现
cluster_label_prop()
基于传播标签查找社区
cluster_leading_eigen()
基于社区矩阵的主特征向量进行社区结构检测
cluster_leiden()
使用Traag, van Eck & Waltman的Leiden算法查找图的社区结构。
cluster_louvain()
通过模块化的多层次优化查找社区结构
cluster_optimal()
最佳社区结构
cluster_spinglass()
基于统计力学查找图中的社区
cluster_walktrap()
通过短随机游走实现社区结构
membership() print(<communities>) modularity(<communities>) length(<communities>) sizes() algorithm() merges() crossing() code_len() is_hierarchical() as.dendrogram(<communities>) as.hclust(<communities>) cut_at() show_trace() plot(<communities>) communities()
用于处理网络社区检测结果的函数
compare()
使用各种指标比较社区结构
groups()
顶点划分的组
make_clusters()
创建一个社团对象。
modularity(<igraph>) modularity_matrix()
图的社区结构的模块化
plot_dendrogram()
社团结构树状图绘制
split_join_distance()
两个社区结构的分割-连接距离
voronoi_cells() experimental
图的Voronoi划分

图的环

feedback_arc_set()
在图中查找反馈弧集
feedback_vertex_set() 实验性
在图中查找反馈顶点集
find_cycle() experimental
查找图中的环(如果存在)
girth()
图的围长
has_eulerian_path() has_eulerian_cycle() eulerian_path() eulerian_cycle()
查找图中的欧拉路径或环
is_acyclic()
无环图
is_dag()
有向无环图
simple_cycles() experimental
查找图中的所有简单环。

连通分量

articulation_points() bridges()
图的关节点和桥
biconnected_components()
双连通分量
component_distribution() largest_component() components() is_connected() count_components()
图的连通分量
decompose()
将图分解为分量
is_biconnected() experimental
检查双连通性

谱嵌入

dim_select()
使用剖面似然为奇异值选择维度。
embed_adjacency_matrix()
邻接矩阵的谱嵌入
embed_laplacian_matrix()
图的拉普拉斯矩阵的谱嵌入

分层随机图

consensus_tree()
从多个分层随机图模型创建一致树
fit_hrg()
拟合分层随机图模型
hrg-methods
分层随机图
hrg()
从igraph图创建分层随机图
hrg_tree()
从分层随机图模型创建igraph图
predict_edges()
基于分层随机图模型预测边
print(<igraphHRG>)
将分层随机图模型打印到屏幕
print(<igraphHRGConsensus>)
将分层随机图一致树打印到屏幕
sample_hrg()
从分层随机图模型中采样

图形化度序列

is_degseq()
检查度序列对于多重图是否有效
is_graphical()
度序列是图形化的吗?

图上的过程

plot(<sir>)
绘制多次SIR模型运行的结果
time_bins() median(<sir>) quantile(<sir>) sir()
图上的SIR模型
random_walk() random_edge_walk()
图上的随机游走

演示

igraph_demo()
逐步运行igraph演示

I/O读/写文件

graph_from_graphdb()
从图数据库加载图以测试图同构。
read_graph()
读取外部文件格式
write_graph()
以某种格式将图写入文件

交互式函数

版本

graph_version()
igraph数据结构版本
upgrade_graph()
igraph数据结构版本

实验性函数

feedback_vertex_set() 实验性
在图中查找反馈顶点集
find_cycle() experimental
查找图中的环(如果存在)
graph_center() 实验性
图的中心顶点
is_biconnected() experimental
检查双连通性
realize_bipartite_degseq() 实验性
从两个度序列确定性地创建一个二分图
sample_chung_lu() chung_lu() 实验性
具有给定预期度的随机图
simple_cycles() experimental
查找图中的所有简单环。
voronoi_cells() experimental
图的Voronoi划分