Expand description
Rust enumerations for igraph’s C constants (igraph_constants.h).
Each enum converts into the raw C value with From (e.g.
igraph_neimode_t::from(NeighborMode::Out)), and back with TryFrom
(an ErrorKind::InvalidValue
error for values that are not part of the enumeration). All of them are
re-exported by the prelude. Module-specific enums (e.g.
layout or community options) live next to the functions that use them.
use igraph::{ffi, prelude::*};
// Out-neighbors follow the edge direction, in-neighbors go against it.
let g = Graph::from_edges(&[(0, 1), (2, 1), (1, 1)], 3, true).unwrap();
assert_eq!(g.neighbors(1, NeighborMode::Out).unwrap(), vec![1]);
assert_eq!(g.neighbors(1, NeighborMode::In).unwrap(), vec![0, 1, 2]);
assert_eq!(g.degree(1, NeighborMode::All, Loops::Twice).unwrap(), vec![4]);
assert_eq!(g.degree(1, NeighborMode::All, Loops::None).unwrap(), vec![2]);
// Conversions to and from the raw C constants.
assert_eq!(ffi::igraph_neimode_t::from(NeighborMode::In), ffi::igraph_neimode_t_IGRAPH_IN);
assert_eq!(NeighborMode::try_from(ffi::igraph_neimode_t_IGRAPH_ALL).unwrap(), NeighborMode::All);
assert!(Order::try_from(42 as ffi::igraph_order_t).is_err());Structs§
- Allowed
Edge Types - Which kinds of edges a graph may contain, as a set of flags
(
igraph_edge_type_sw_t, including the combinationIGRAPH_LOOPS_SW | IGRAPH_MULTI_SW).
Enums§
- AddWeights
- Whether to add weights when converting from matrices (
igraph_add_weights_t). - Adjacency
- How to interpret an adjacency matrix (
igraph_adjacency_t). - Barabasi
Algorithm - Algorithm of the Barabási–Albert generator (
igraph_barabasi_algorithm_t). - Chung
LuVariant - Variant of the Chung–Lu model (
igraph_chung_lu_t). - Community
Comparison - Measure used to compare two community structures (
igraph_community_comparison_t). - Connectedness
- Weak or strong connectedness (
igraph_connectedness_t). - Degree
Sequence Method - Method for sampling graphs with a given degree sequence (
igraph_degseq_t). - Edge
Order - Edge ordering for edge selectors (
igraph_edgeorder_type_t). - Edge
Type Sw - Which kind of edges a random generator may produce (
igraph_edge_type_sw_t). - FasAlgorithm
- Feedback arc set algorithm (
igraph_fas_algorithm_t). - FvsAlgorithm
- Feedback vertex set algorithm (
igraph_fvs_algorithm_t). - GetAdjacency
- Which part of the adjacency matrix to produce for undirected graphs
(
igraph_get_adjacency_t). - Layout
Grid - Whether force-directed layouts use a grid (
igraph_layout_grid_t). - Loops
- How self-loops are counted (
igraph_loops_t). - LpaVariant
- Label propagation variant (
igraph_lpa_variant_t). - Matrix
Storage - Storage order of matrices given as flat arrays (
igraph_matrix_storage_t). - MstAlgorithm
- Minimum spanning tree algorithm (
igraph_mst_algorithm_t). - Neighbor
Mode - Which neighbors (or incident edges) to consider in directed graphs
(
igraph_neimode_t). Ignored for undirected graphs. - Order
- Sorting order (
igraph_order_t). - Product
- Kind of graph product (
igraph_product_t). - Random
Tree Method - Random tree sampling algorithm (
igraph_random_tree_t). - Random
Walk Stuck - What a random walk does when stuck (
igraph_random_walk_stuck_t). - Realize
Degseq - Vertex choice when realizing a degree sequence (
igraph_realize_degseq_t). - Reciprocity
- Reciprocity definition (
igraph_reciprocity_t). - Spincomm
Update - Update rule of the spinglass community detection (
igraph_spincomm_update_t). - Spinglass
Implementation - Spinglass implementation (
igraph_spinglass_implementation_t). - Star
Mode - Orientation of a star graph (
igraph_star_mode_t). - Subgraph
Implementation - Implementation strategy for induced subgraphs (
igraph_subgraph_implementation_t). - ToDirected
- How to convert undirected edges to directed ones (
igraph_to_directed_t). - ToUndirected
- How to convert directed edges to undirected ones (
igraph_to_undirected_t). - Transitivity
Mode - Value of local transitivity for vertices of degree < 2 (
igraph_transitivity_mode_t). - Tree
Mode - Orientation of a tree (
igraph_tree_mode_t). - Vconn
Nei - What to do when computing the vertex connectivity of two adjacent
vertices, which no vertex removal can disconnect
(
igraph_vconn_nei_t). - Voronoi
Tiebreaker - Tie breaking in Voronoi partitioning (
igraph_voronoi_tiebreaker_t). - Wheel
Mode - Orientation of a wheel graph (
igraph_wheel_mode_t).
Type Aliases§
- edge_
type_ sw_ t Deprecated - Former name of
EdgeTypeSw, kept for backwards compatibility.