| igraph Reference Manual |
|---|
igraph_vcount — The number of vertices in a graphigraph_ecount — The number of edges in a graphigraph_edge — Gives the head and tail vertices of an edge.igraph_get_eid — Get the edge id from the end points of an edgeigraph_neighbors — Adjacent vertices to a vertex.igraph_adjacent — Gives the adjacent edges of a vertex.igraph_is_directed — Is this a directed graph?igraph_degree — The degree of some vertices in a graph.
igraph_integer_t igraph_vcount(const igraph_t *graph);
Arguments:
|
The graph. |
Returns:
Number of vertices. |
Time complexity: O(1)
igraph_integer_t igraph_ecount(const igraph_t *graph);
Arguments:
|
The graph. |
Returns:
Number of edges. |
Time complexity: O(1)
int igraph_edge(const igraph_t *graph, igraph_integer_t eid, igraph_integer_t *from, igraph_integer_t *to);
Arguments:
|
The graph object. |
|
The edge id. |
|
Pointer to an igraph_integer_t. The tail of the edge will be placed here. |
|
Pointer to an igraph_integer_t. The head of the edge will be placed here. |
Returns:
Error code. The current implementation always returns with success. |
See also:
|
Added in version 0.2.
Time complexity: O(1).
int igraph_get_eid(const igraph_t *graph, igraph_integer_t *eid, igraph_integer_t pfrom, igraph_integer_t pto, igraph_bool_t directed);
Arguments:
|
The graph object. |
|
Pointer to an integer, the edge id will be stored here. |
|
The starting point of the edge. |
|
The end points of the edge. |
|
Logical constant, whether to search for directed edges in a directed graph. Ignored for undirected graphs. |
Returns:
Error code. |
See also:
|
For undirected graphs from and to are exchangable.
Added in version 0.2.
int igraph_neighbors(const igraph_t *graph, igraph_vector_t *neis, igraph_integer_t pnode, igraph_neimode_t mode);
Arguments:
|
The graph to work on. |
|
This vector will contain the result. The vector should be initialized before and will be resized. Starting from igraph version 0.4 this vector is always sorted, the vertex ids are in increasing order. |
|
The id of the node of which the adjacent vertices are searched. |
|
Defines the way adjacent vertices are searched for
directed graphs. It can have the following values:
|
Returns:
Error code:
|
Time complexity: O(d), d is the number of adjacent vertices to the queried vertex.
int igraph_adjacent(const igraph_t *graph, igraph_vector_t *eids, igraph_integer_t pnode, igraph_neimode_t mode);
Arguments:
|
The graph object. |
|
An initialized vector_t object. It will be resized to hold the result. |
|
A vertex id. |
|
Specifies what kind of edges to include for directed
graphs. |
Returns:
Error code. |
Added in version 0.2.
Time complexity: O(d), the number of adjacent edges to pnode.
igraph_bool_t igraph_is_directed(const igraph_t *graph);
Arguments:
|
The graph. |
Returns:
Logical value, |
Time complexity: O(1)
int igraph_degree(const igraph_t *graph, igraph_vector_t *res, const igraph_vs_t vids, igraph_neimode_t mode, igraph_bool_t loops);
This function calculates the in-, out- or total degree of the specified vertices.
Arguments:
|
The graph. |
|
Vector, this will contain the result. It should be initialized and will be resized to be the appropriate size. |
|
Vector, giving the vertex ids of which the degree will be calculated. |
|
Defines the type of the degree.
|
|
Boolean, gives whether the self-loops should be counted. |
Returns:
Error code:
|
Time complexity: O(v) if loops is TRUE, and O(v*d) otherwise. v is the number vertices for which the degree will be calculated, and d is their (average) degree.
| << 2.1. Graph Constructors and Destructors | 2.3. Adding and Deleting Vertices and Edges >> |