Gaining information about graph structure
vcount(g)
|
count the number of vertices |
ecount(g)
|
count the number of edges |
neighbors(g,v)
|
list the neighbors of a vertex |
incident(g,v)
|
list the incident edges of a vertex |
is.directed(g)
|
determine whether the graph is directed |
are.connected(g,v1,v2)
|
determine whether there is an edge between two vertices |
get.edge(g,id)
|
get endpoints of an edge |
get.edges(g,es)
|
get endpoints of a list of edges |
Graph, vertex and edge attributes
In the following functions, ? can be graph , vertex or edge . |
get.?.attribute(g,n)
|
set.?.attribute(g,n,v)
|
list.?.attributes(g)
|
?.attributes(g)
|
remove.?.attribute(g,n)
|
Various methods for creating graphs
graph.empty()
|
graph.star(n)
|
graph.lattice(c(n,m))
|
graph.ring(n)
|
graph.tree(n)
|
graph.full(n)
|
graph.full.citation(n)
|
graph.atlas(0-1252)
|
graph(c(1,2,2,3,3,4,...))
|
graph.edgelist(edge.matrix)
|
graph.formula(1-2,3,4-+5)
|
|
|
Vertex and edge sequences and iterators
V(g)
|
list vertices in a igraph.vs object |
V(g)$number
|
get or set vertices properties |
V(g)[number<50]
|
get a subset of vertices |
E(g)
|
list edges in a igraph.es object |
Method for structural manipulation of graphs
g[]
|
get and set adjacency matrix |
g[[]]
|
get adjacency list |
Degree and degree distribution of the vertices
degree(g)
|
degree.distribution(g)
|
Graph Algebra
graph.union(g1,g2)
|
graph.difference(g1,g2)
|
Print Graph
summary(g)
|
summary |
str(g)
|
summary with edge list |
print(g)
|
customizable printing function |
Neighborhood of graph vertices
neighborhood.size(g,o)
|
gives a list of neighborhood size for each vertex |
neighborhood(g,o)
|
gives a list of neighborhood vertices for each vertex |
graph.neighborhood(g,o)
|
gives the neighborhood graphs |
connect.neighborhood(g,o)
|
creates a new graph by connect each vertex with its neighbor vertices |
|
Created By
Metadata
Favourited By
Comments
good cheat sheet
Add a Comment
Related Cheat Sheets