Gaining information about graph structurevcount(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 attributesIn 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 graphsgraph.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 iteratorsV(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 graphsg[]
| get and set adjacency matrix | g[[]]
| get adjacency list |
Degree and degree distribution of the verticesdegree(g)
| degree.distribution(g)
|
Graph Algebragraph.union(g1,g2)
| graph.difference(g1,g2)
|
Print Graphsummary(g)
| summary | str(g)
| summary with edge list | print(g)
| customizable printing function |
Neighborhood of graph verticesneighborhood.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