unobtanium-graph-algorithms 0.1.0

Graph ranking algorithms for the unobtanium search engine
Documentation
// SPDX-FileCopyrightText: 2025 Slatian 2025
//
// SPDX-License-Identifier: LGPL-3.0-only

#![warn(missing_docs)]

#![doc = include_str!("../README.md")]
//! ## Where to start
//!
//! Construct a [Graph], run one of the `populate_*()` methods and follow its recommendations on a `run_*()` method.
//!
//! Example: TextRank keyword extraction
//! ```rust
//! use unobtanium_graph_algorithms::Graph;
//! 
//! let mut graph = Graph::new();
//! graph.populate_for_textrank(&["This", "text", "is", "about", "cats", "and", "dogs", "but", "mostly", "dogs"], 2);
//! let result = graph.run_pagerank(&Default::default());
//!
//! // The top word is "dogs"
//! let top_word = result.sorted_iter().next().unwrap();
//! assert_eq!(*top_word.0, "dogs");
//! assert!(top_word.1 > 1.3, "Expected: score (={0}) > 1.3", top_word.1);
//!
//! // The total value in the pagerank graph is equal to the result length 
//! let total_score_sum = result.unsorted_iter().fold(0.0, |a, i| a+i.1);
//! assert_eq!(result.len() as f32, total_score_sum);
//! ```

mod graph;
mod node;
mod pagerank_configuration;

pub use graph::BrandedNodeId;
pub use graph::Graph;
pub use graph::MutableGraph;
pub use graph::ranked_nodes::RankedNodes;
pub use graph::ranked_nodes::SortedRankedNodesIter;
pub use graph::ranked_nodes::UnsortedRankedNodesIter;
pub use pagerank_configuration::PageRankConfiguration;