Skip to contents

igraph options

igraph_options() igraph_opt()
Parameters for the igraph package
with_igraph_opt()
Run code with a temporary igraph options setting

Construction

Deterministic constructors

connect() ego_size() neighborhood_size() ego() neighborhood() make_ego_graph() make_neighborhood_graph()
Neighborhood of graph vertices
make_()
Make a new graph
make_bipartite_graph() bipartite_graph()
Create a bipartite graph
make_chordal_ring() chordal_ring()
Create an extended chordal ring graph
make_clusters()
Creates a communities object.
make_de_bruijn_graph() de_bruijn_graph()
De Bruijn graphs
make_empty_graph() empty_graph()
A graph with no edges
make_from_prufer() from_prufer()
Create an undirected tree graph from its Prüfer sequence
make_full_bipartite_graph() full_bipartite_graph()
Create a full bipartite graph
make_full_citation_graph() full_citation_graph()
Create a complete (full) citation graph
make_full_graph() full_graph()
Create a full graph
make_graph() make_directed_graph() make_undirected_graph() directed_graph() undirected_graph()
Create an igraph graph from a list of edges, or a notable graph
make_kautz_graph() kautz_graph()
Kautz graphs
make_lattice() lattice()
Create a lattice graph
make_line_graph() line_graph()
Line graph of a graph
make_ring() ring()
Create a ring graph
make_star() star()
Create a star graph, a tree with n vertices and n - 1 leaves
make_tree() tree()
Create tree graphs
realize_degseq()
Creating a graph from a given degree sequence, deterministically
realize_bipartite_degseq()
Creating a bipartite graph from two degree sequences, deterministically
graph_from_atlas() atlas()
Create a graph from the Graph Atlas
graph_from_edgelist() from_edgelist()
Create a graph from an edge list matrix
graph_from_literal() from_literal()
Creating (small) graphs via a simple interface
graph_()
Convert object to a graph
graph_from_lcf()
Creating a graph from LCF notation
as_data_frame() graph_from_data_frame() from_data_frame()
Creating igraph graphs from data frames or vice-versa

Stochastic constructors (random graph models)

sample_()
Sample from a random graph model
sample_bipartite() bipartite()
Bipartite random graphs
sample_correlated_gnp()
Generate a new random graph from a given graph by randomly adding/removing edges
sample_correlated_gnp_pair()
Sample a pair of correlated \(G(n,p)\) random graphs
sample_degseq() degseq()
Generate random graphs with a given degree sequence
sample_dot_product() dot_product()
Generate random graphs according to the random dot product graph model
sample_fitness()
Random graphs from vertex fitness scores
sample_fitness_pl()
Scale-free random graphs, from vertex fitness scores
sample_forestfire()
Forest Fire Network Model
sample_gnm() gnm()
Generate random graphs according to the \(G(n,m)\) Erdős-Rényi model
sample_gnp() gnp()
Generate random graphs according to the \(G(n,p)\) Erdős-Rényi model
sample_grg() grg()
Geometric random graphs
sample_growing() growing()
Growing random graph generation
sample_hierarchical_sbm() hierarchical_sbm()
Sample the hierarchical stochastic block model
sample_islands()
A graph with subgraphs that are each a random graph.
sample_k_regular()
Create a random regular graph
sample_last_cit() last_cit() sample_cit_types() cit_types() sample_cit_cit_types() cit_cit_types()
Random citation graphs
sample_pa() pa()
Generate random graphs using preferential attachment
sample_pa_age() pa_age()
Generate an evolving random graph with preferential attachment and aging
sample_pref() pref() sample_asym_pref() asym_pref()
Trait-based random generation
sample_sbm() sbm()
Sample stochastic block model
sample_smallworld() smallworld()
The Watts-Strogatz small-world model
sample_traits_callaway() traits_callaway() sample_traits() traits()
Graph generation based on different vertex types
sample_tree()
Sample trees randomly and uniformly

Constructor modifiers

simplified()
Constructor modifier to drop multiple and loop edges
with_edge_()
Constructor modifier to add edge attributes
with_graph_()
Constructor modifier to add graph attributes
with_vertex_()
Constructor modifier to add vertex attributes
without_attr()
Construtor modifier to remove all attributes from a graph
without_loops()
Constructor modifier to drop loop edges
without_multiples()
Constructor modifier to drop multiple edges

Convert to igraph

as.igraph()
Conversion to igraph

Adjacency matrices

graph_from_adjacency_matrix() from_adjacency()
Create graphs from adjacency matrices

Visualization

add_layout_()
Add layout to graph
component_wise()
Component-wise layout
layout_() print(<igraph_layout_spec>) print(<igraph_layout_modifier>)
Graph layouts
layout_as_bipartite() as_bipartite()
Simple two-row layout for bipartite graphs
layout_as_star() as_star()
Generate coordinates to place the vertices of a graph in a star-shape
layout_as_tree() as_tree()
The Reingold-Tilford graph layout algorithm
layout_in_circle() in_circle()
Graph layout with vertices on a circle.
layout_nicely() nicely()
Choose an appropriate graph layout algorithm automatically
layout_on_sphere() on_sphere()
Graph layout with vertices on the surface of a sphere
layout_randomly() randomly()
Randomly place vertices on a plane or in 3d space
layout_with_dh() with_dh()
The Davidson-Harel layout algorithm
layout_with_fr() with_fr()
The Fruchterman-Reingold layout algorithm
layout_with_gem() with_gem()
The GEM layout algorithm
layout_with_graphopt() with_graphopt()
The graphopt layout algorithm
layout_with_kk() with_kk()
The Kamada-Kawai layout algorithm
layout_with_lgl() with_lgl()
Large Graph Layout
layout_with_mds() with_mds()
Graph layout by multidimensional scaling
layout_with_sugiyama() with_sugiyama()
The Sugiyama graph layout generator
merge_coords() layout_components()
Merging graph layouts
norm_coords()
Normalize coordinates for plotting graphs
normalize()
Normalize layout
layout_with_drl() with_drl()
The DrL graph layout generator
categorical_pal()
Palette for categories
diverging_pal()
Diverging palette
r_pal()
The default R palette
sequential_pal()
Sequential palette
plot(<igraph>)
Plotting of graphs
rglplot()
3D plotting of graphs with OpenGL
igraph.plotting
Drawing graphs
plot_dendrogram(<igraphHRG>)
HRG dendrogram plot
plot_dendrogram()
Community structure dendrogram plots
curve_multiple()
Optimal edge curvature when plotting graphs
shapes() shape_noclip() shape_noplot() add_shape()
Various vertex shapes when plotting igraph graphs
vertex.shape.pie
Using pie charts as vertices in graph plots

Graph coloring

greedy_vertex_coloring()
Greedy vertex coloring

Functions for manipulating graphs

add_edges()
Add edges to a graph
add_vertices()
Add vertices to a graph
complementer()
Complementer of a graph
compose()
Compose two graphs as binary relations
contract()
Contract several vertices into a single one
delete_edges()
Delete edges from a graph
delete_vertices()
Delete vertices from a graph
difference()
Difference of two sets
difference(<igraph>)
Difference of graphs
disjoint_union() `%du%`
Disjoint union of graphs
edge() edges()
Helper function for adding and deleting edges
connect() ego_size() neighborhood_size() ego() neighborhood() make_ego_graph() make_neighborhood_graph()
Neighborhood of graph vertices
`-`(<igraph>)
Delete vertices or edges from a graph
intersection()
Intersection of two or more sets
intersection(<igraph>)
Intersection of graphs
path()
Helper function to add or delete edges along a path
permute()
Permute the vertices of a graph
`+`(<igraph>)
Add vertices, edges or another graph to a graph
rep(<igraph>) `*`(<igraph>)
Replicate a graph multiple times
reverse_edges() t(<igraph>)
Reverse edges in a graph
simplify() is_simple() simplify_and_colorize()
Simple graphs
union()
Union of two or more sets
union(<igraph>)
Union of graphs
vertex() vertices()
Helper function for adding and deleting vertices

Rewiring functions

each_edge()
Rewires the endpoints of the edges of a graph to a random vertex
keeping_degseq()
Graph rewiring while preserving the degree distribution
rewire()
Rewiring edges of a graph

Vertex, edge and graph attributes

delete_edge_attr()
Delete an edge attribute
delete_graph_attr()
Delete a graph attribute
delete_vertex_attr()
Delete a vertex attribute
`edge_attr<-`()
Set one or more edge attributes
edge_attr()
Query edge attributes of a graph
edge_attr_names()
List names of edge attributes
`graph_attr<-`()
Set all or some graph attributes
graph_attr()
Graph attributes of a graph
graph_attr_names()
List names of graph attributes
igraph-attribute-combination attribute.combination
How igraph functions handle attributes when the graph changes
`$`(<igraph>) `$<-`(<igraph>)
Getting and setting graph attributes, shortcut
`[[<-`(<igraph.vs>) `[<-`(<igraph.vs>) `$`(<igraph.vs>) `$<-`(<igraph.vs>) `V<-`()
Query or set attributes of the vertices in a vertex sequence
set_edge_attr()
Set edge attributes
set_graph_attr()
Set a graph attribute
set_vertex_attr()
Set vertex attributes
`vertex_attr<-`()
Set one or more vertex attributes
vertex_attr()
Query vertex attributes of a graph
vertex_attr_names()
List names of vertex attributes

Vertex and edge sequences

E()
Edges of a graph
V()
Vertices of a graph
as_ids()
Convert a vertex or edge sequence to an ordinary vector
`[[<-`(<igraph.es>) `[<-`(<igraph.es>) `$`(<igraph.es>) `$<-`(<igraph.es>) `E<-`()
Query or set attributes of the edges in an edge sequence
`[`(<igraph.es>)
Indexing edge sequences
`[[`(<igraph.es>)
Select edges and show their metadata
`[[<-`(<igraph.vs>) `[<-`(<igraph.vs>) `$`(<igraph.vs>) `$<-`(<igraph.vs>) `V<-`()
Query or set attributes of the vertices in a vertex sequence
`[`(<igraph.vs>)
Indexing vertex sequences
`[[`(<igraph.vs>)
Select vertices and show their metadata
print(<igraph.es>)
Print an edge sequence to the screen
print(<igraph.vs>)
Show a vertex sequence on the screen
c(<igraph.es>)
Concatenate edge sequences
c(<igraph.vs>)
Concatenate vertex sequences
difference(<igraph.es>)
Difference of edge sequences
difference(<igraph.vs>)
Difference of vertex sequences
intersection(<igraph.es>)
Intersection of edge sequences
intersection(<igraph.vs>)
Intersection of vertex sequences
rev(<igraph.es>)
Reverse the order in an edge sequence
rev(<igraph.vs>)
Reverse the order in a vertex sequence
union(<igraph.es>)
Union of edge sequences
union(<igraph.vs>)
Union of vertex sequences
unique(<igraph.es>)
Remove duplicate edges from an edge sequence
unique(<igraph.vs>)
Remove duplicate vertices from a vertex sequence

Utilities

Graph ID, comparison, name, weight

graph_id()
Get the id of a graph
identical_graphs()
Decide if two graphs are identical
is_igraph()
Is this object an igraph graph?
is_named()
Named graphs
is_weighted()
Weighted graphs
is_chordal()
Chordality of a graph

Conversion

as.directed() as.undirected()
Convert between directed and undirected graphs
as.matrix(<igraph>)
Convert igraph objects to adjacency or edge list matrices
as_adj_list() as_adj_edge_list()
Adjacency lists
as_adjacency_matrix() as_adj()
Convert a graph to an adjacency matrix
as_biadjacency_matrix()
Bipartite adjacency matrix of a bipartite graph
as_edgelist()
Convert a graph to an edge list
as_graphnel()
Convert igraph graphs to graphNEL objects from the graph package
as_long_data_frame()
Convert a graph to a long data frame
graph_from_adj_list()
Create graphs from adjacency lists
as_data_frame() graph_from_data_frame() from_data_frame()
Creating igraph graphs from data frames or vice-versa
graph_from_graphnel()
Convert graphNEL objects from the graph package to igraph

Env and data

dot-data .data dot-env .env
.data and .env pronouns

Printing

head_print()
Print the only the head of an R object
indent_print()
Indent a printout
print(<igraph>) summary(<igraph>)
Print graphs to the terminal
is_printer_callback()
Is this a printer callback?
printer_callback()
Create a printer callback function

Latent position vector samplers

sample_dirichlet()
Sample from a Dirichlet distribution
sample_sphere_surface()
Sample vectors uniformly from the surface of a sphere
sample_sphere_volume()
Sample vectors uniformly from the volume of a sphere

Miscellaneous

convex_hull()
Convex hull of a set of vertices
running_mean()
Running mean of a time series
sample_seq()
Sampling a random integer sequence
fit_power_law()
Fitting a power-law distribution function to discrete data

Structural properties

bfs()
Breadth-first search
component_distribution() largest_component() components() is_connected() count_components()
Connected components of a graph
constraint()
Burt's constraint
coreness()
K-core decomposition of graphs
degree() degree_distribution()
Degree and degree distribution of the vertices
dfs()
Depth-first search
distance_table() mean_distance() distances() shortest_paths() all_shortest_paths()
Shortest (directed or undirected) paths between vertices
edge_density()
Graph density
connect() ego_size() neighborhood_size() ego() neighborhood() make_ego_graph() make_neighborhood_graph()
Neighborhood of graph vertices
feedback_arc_set()
Finding a feedback arc set in a graph
girth()
Girth of a graph
is_acyclic()
Acyclic graphs
is_dag()
Directed acyclic graphs
k_shortest_paths()
Find the \(k\) shortest paths between two vertices
knn()
Average nearest neighbor degree
is_matching() is_max_matching() max_bipartite_match()
Matching
reciprocity()
Reciprocity of graphs
subcomponent()
In- or out- component of a vertex
subgraph() induced_subgraph() subgraph.edges()
Subgraph of a graph
topo_sort()
Topological sorting of vertices in a graph
transitivity()
Transitivity of a graph
unfold_tree()
Convert a general graph into a forest
which_multiple() any_multiple() count_multiple() which_loop() any_loop()
Find the multiple or loop edges in a graph
which_mutual()
Find mutual edges in a directed graph
cocitation() bibcoupling()
Cocitation coupling
similarity()
Similarity measures of two vertices
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()
Calculate Cohesive Blocks
triangles() count_triangles()
Find triangles in graphs
assortativity() assortativity_nominal() assortativity_degree()
Assortativity coefficient
spectrum()
Eigenvalues and eigenvectors of the adjacency matrix of a graph

Matrices

laplacian_matrix()
Graph Laplacian
as_adjacency_matrix() as_adj()
Convert a graph to an adjacency matrix
stochastic_matrix()
Stochastic matrix of a graph

Chordal graphs

is_chordal()
Chordality of a graph
max_cardinality()
Maximum cardinality search

Triangles and transitivity

triangles() count_triangles()
Find triangles in graphs
transitivity()
Transitivity of a graph

Paths

all_simple_paths()
List all simple paths from one source
diameter() get_diameter() farthest_vertices()
Diameter of a graph
distance_table() mean_distance() distances() shortest_paths() all_shortest_paths()
Shortest (directed or undirected) paths between vertices
eccentricity()
Eccentricity of the vertices in a graph
graph_center()
Central vertices of a graph
radius()
Radius of a graph

Bipartite graphs

bipartite_mapping()
Decide whether a graph is bipartite
bipartite_projection() bipartite_projection_size()
Project a bipartite graph
is_bipartite()
Checks whether the graph has a vertex attribute called type.
make_bipartite_graph() bipartite_graph()
Create a bipartite graph
graph_from_biadjacency_matrix()
Create graphs from a bipartite adjacency matrix
as_data_frame() graph_from_data_frame() from_data_frame()
Creating igraph graphs from data frames or vice-versa

Efficiency

Similarity

similarity()
Similarity measures of two vertices

Trees

is_forest()
Decide whether a graph is a forest.
is_tree()
Decide whether a graph is a tree.
make_from_prufer() from_prufer()
Create an undirected tree graph from its Prüfer sequence
sample_spanning_tree()
Samples from the spanning trees of a graph randomly and uniformly
to_prufer()
Convert a tree graph to its Prüfer sequence
mst()
Minimum spanning tree

Structural queries

adjacent_vertices()
Adjacent vertices of multiple vertices in a graph
are_adjacent()
Are two vertices adjacent?
ends()
Incident vertices of some graph edges
get.edge.ids()
Find the edge ids based on the incident vertices of the edges
vcount() gorder()
Order (number of vertices) of a graph
gsize() ecount()
The size of the graph (number of edges)
head_of()
Head of the edge(s) in a graph
incident()
Incident edges of a vertex in a graph
incident_edges()
Incident edges of multiple vertices in a graph
is_directed()
Check whether a graph is directed
neighbors()
Neighboring (adjacent) vertices in a graph
`[`(<igraph>)
Query and manipulate a graph as it were an adjacency matrix
`[[`(<igraph>)
Query and manipulate a graph as it were an adjacency list
tail_of()
Tails of the edge(s) in a graph

ARPACK eigenvector calculation

arpack_defaults() arpack()
ARPACK eigenvector calculation

Centrality measures

alpha_centrality()
Find Bonacich alpha centrality scores of network positions
betweenness() edge_betweenness()
Vertex and edge betweenness centrality
closeness()
Closeness centrality of vertices
diversity()
Graph diversity
eigen_centrality()
Find Eigenvector Centrality Scores of Network Positions
harmonic_centrality()
Harmonic centrality of vertices
hub_score() authority_score()
Kleinberg's hub and authority centrality scores.
page_rank()
The Page Rank algorithm
power_centrality()
Find Bonacich Power Centrality Scores of Network Positions
spectrum()
Eigenvalues and eigenvectors of the adjacency matrix of a graph
strength()
Strength or weighted vertex degree
subgraph_centrality()
Find subgraph centrality scores of network positions

Centralization

centr_betw()
Centralize a graph according to the betweenness of vertices
centr_betw_tmax()
Theoretical maximum for betweenness centralization
centr_clo()
Centralize a graph according to the closeness of vertices
centr_clo_tmax()
Theoretical maximum for closeness centralization
centr_degree()
Centralize a graph according to the degrees of vertices
centr_degree_tmax()
Theoretical maximum for degree centralization
centr_eigen()
Centralize a graph according to the eigenvector centrality of vertices
centr_eigen_tmax()
Theoretical maximum for betweenness centralization
centralize()
Centralization of a graph

Scan statistics

local_scan()
Compute local scan statistics on graphs
scan_stat()
Scan statistics on a time series of graphs

Graph motifs and subgraphs

count_motifs()
Graph motifs
dyad_census()
Dyad census of a graph
motifs()
Graph motifs
sample_motifs()
Graph motifs
triad_census()
Triad census, subgraphs with three vertices

Graph isomorphism

canonical_permutation()
Canonical permutation of a graph
count_isomorphisms()
Count the number of isomorphic mappings between two graphs
count_subgraph_isomorphisms()
Count the isomorphic mappings between a graph and the subgraphs of another graph
graph_from_isomorphism_class()
Create a graph from an isomorphism class
isomorphic() is_isomorphic_to()
Decide if two graphs are isomorphic
isomorphism_class()
Isomorphism class of a graph
isomorphisms()
Calculate all isomorphic mappings between the vertices of two graphs
subgraph_isomorphic() is_subgraph_isomorphic_to()
Decide if a graph is subgraph isomorphic to another one
subgraph_isomorphisms()
All isomorphic mappings between a graph and subgraphs of another graph
simplify() is_simple() simplify_and_colorize()
Simple graphs
automorphism_group()
Generating set of the automorphism group of a graph
count_automorphisms()
Number of automorphisms
permute()
Permute the vertices of a graph

Graph matching

match_vertices()
Match Graphs given a seeding of vertex correspondences

Maximum flow and connectivity

dominator_tree()
Dominator tree
edge_connectivity() edge_disjoint_paths() adhesion()
Edge connectivity
is_min_separator()
Minimal vertex separators
is_separator()
Vertex separators
max_flow()
Maximum flow in a graph
min_cut()
Minimum cut in a graph
min_separators()
Minimum size vertex separators
min_st_separators()
Minimum size vertex separators
st_cuts()
List all (s,t)-cuts of a graph
st_min_cuts()
List all minimum \((s,t)\)-cuts of a graph
vertex_connectivity() vertex_disjoint_paths() cohesion(<igraph>)
Vertex connectivity

Cliques

cliques() largest_cliques() max_cliques() count_max_cliques() clique_num() largest_weighted_cliques() weighted_clique_num() clique_size_counts()
Functions to find cliques, i.e. complete subgraphs in a graph
ivs() largest_ivs() maximal_ivs() ivs_size()
Independent vertex sets
weighted_cliques()
Functions to find weighted cliques, i.e. vertex-weighted complete subgraphs in a graph
graphlet_basis() graphlet_proj() graphlets()
Graphlet decomposition of a graph

Community detection

as_membership()
Declare a numeric vector as a membership vector
cluster_edge_betweenness()
Community structure detection based on edge betweenness
cluster_fast_greedy()
Community structure via greedy optimization of modularity
cluster_fluid_communities()
Community detection algorithm based on interacting fluids
cluster_infomap()
Infomap community finding
cluster_label_prop()
Finding communities based on propagating labels
cluster_leading_eigen()
Community structure detecting based on the leading eigenvector of the community matrix
cluster_leiden()
Finding community structure of a graph using the Leiden algorithm of Traag, van Eck & Waltman.
cluster_louvain()
Finding community structure by multi-level optimization of modularity
cluster_optimal()
Optimal community structure
cluster_spinglass()
Finding communities in graphs based on statistical meachanics
cluster_walktrap()
Community structure via short random walks
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()
Functions to deal with the result of network community detection
compare()
Compares community structures using various metrics
groups()
Groups of a vertex partitioning
make_clusters()
Creates a communities object.
modularity(<igraph>) modularity_matrix()
Modularity of a community structure of a graph
plot_dendrogram()
Community structure dendrogram plots
split_join_distance()
Split-join distance of two community structures
voronoi_cells()
Voronoi partitioning of a graph

Graph cycles

feedback_arc_set()
Finding a feedback arc set in a graph
girth()
Girth of a graph
has_eulerian_path() has_eulerian_cycle() eulerian_path() eulerian_cycle()
Find Eulerian paths or cycles in a graph
is_acyclic()
Acyclic graphs
is_dag()
Directed acyclic graphs

Connected components

articulation_points() bridges()
Articulation points and bridges of a graph
biconnected_components()
Biconnected components
component_distribution() largest_component() components() is_connected() count_components()
Connected components of a graph
decompose()
Decompose a graph into components
is_biconnected()
Check biconnectedness

Spectral embedding

dim_select()
Dimensionality selection for singular values using profile likelihood.
embed_adjacency_matrix()
Spectral Embedding of Adjacency Matrices
embed_laplacian_matrix()
Spectral Embedding of the Laplacian of a Graph

Hierarchical random graphs

consensus_tree()
Create a consensus tree from several hierarchical random graph models
fit_hrg()
Fit a hierarchical random graph model
hrg-methods
Hierarchical random graphs
hrg()
Create a hierarchical random graph from an igraph graph
hrg_tree()
Create an igraph graph from a hierarchical random graph model
predict_edges()
Predict edges based on a hierarchical random graph model
print(<igraphHRG>)
Print a hierarchical random graph model to the screen
print(<igraphHRGConsensus>)
Print a hierarchical random graph consensus tree to the screen
sample_hrg()
Sample from a hierarchical random graph model

Graphical degree sequences

is_degseq()
Check if a degree sequence is valid for a multi-graph
is_graphical()
Is a degree sequence graphical?

Processes on graphs

plot(<sir>)
Plotting the results on multiple SIR model runs
time_bins() median(<sir>) quantile(<sir>) sir()
SIR model on graphs
random_walk() random_edge_walk()
Random walk on a graph

Demo

igraph_demo()
Run igraph demos, step by step

I/O read/write files

graph_from_graphdb()
Load a graph from the graph database for testing graph isomorphism.
read_graph()
Reading foreign file formats
write_graph()
Writing the graph to a file in some format

Interactive functions

Versions

graph_version()
igraph data structure versions
upgrade_graph()
igraph data structure versions